
import sys


def register_objects():
    # local import to avoid circular import failure
    from neutron.common import utils
    utils.import_modules_recursively(sys.modules[__name__].__file__)


import os
import sys


def register_objects():
    # local import to avoid circular import failure
    from neutron.common import utils
    dirn = os.path.dirname(sys.modules[__name__].__file__)
    utils.import_modules_recursively(dirn)

Use dirname in object recursive import
Use dirname in object recursive import

__file__ just returns the init file which there was nothing
under.

TrivialFix

Change-Id: I39da8a50c0b9197b7a5cb3d5ca4fd95f8d739eaa

  
+ import os
  import sys
  
  
  def register_objects():
      # local import to avoid circular import failure
      from neutron.common import utils
-     utils.import_modules_recursively(sys.modules[__name__].__file__)
+     dirn = os.path.dirname(sys.modules[__name__].__file__)
+     utils.import_modules_recursively(dirn)
  
Use dirname in object recursive import
## Code Before:

import sys


def register_objects():
    # local import to avoid circular import failure
    from neutron.common import utils
    utils.import_modules_recursively(sys.modules[__name__].__file__)

## Instruction:
Use dirname in object recursive import
## Code After:

import os
import sys


def register_objects():
    # local import to avoid circular import failure
    from neutron.common import utils
    dirn = os.path.dirname(sys.modules[__name__].__file__)
    utils.import_modules_recursively(dirn)
