← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1634735] Re: recursive module import not working correctly in utils.py

 

Reviewed:  https://review.openstack.org/388340
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=676257cea09b736328caacc61182e27d369e254b
Submitter: Jenkins
Branch:    master

commit 676257cea09b736328caacc61182e27d369e254b
Author: Martin Matyáš <martinx.maty@xxxxxxxxx>
Date:   Tue Oct 18 21:05:15 2016 -0700

    Remove recursion from import_modules_recursively
    
    Since the function already uses os.walk that will iterate through all
    subdirectories for us, there is no need to recursively call the
    function.
    
    The recursive call was not just redundant, but also had another problem,
    where we were passing relative paths to subdirectories, which made the
    function to attempt importing modules that are not located under the
    topdir. It could crash, or, worse, import a module that is
    not under the expected parent directory.
    
    This patch also modifies an existing unit test for the function to
    validate that modules from subdirectories are also imported, even
    without the recursive call.
    
    Change-Id: I8b3a844460e4987b8a8375b01353d01e57d91604
    Closes-Bug: #1634735


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1634735

Title:
  recursive module import not working correctly in utils.py

Status in neutron:
  Fix Released

Bug description:
  Recursive module import not working correctly. Recurse is called
  without full path in import_modules_recursively causing performing
  module imports on inappropriate/unwanted directories.

  https://github.com/openstack/neutron/blob/71f2d2bc90aaf9ee696cd4e4f29879ba6c5703b5/neutron/common/utils.py#L865

  One of impacts:
  https://bugs.launchpad.net/kolla/+bug/1634712

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1634735/+subscriptions


References