← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1612959] Re: neutron DB sync fails: ImportError: No module named tests

 

Reviewed:  https://review.openstack.org/355185
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=5925364c9ac05e266637183ff91695d06234e3cb
Submitter: Jenkins
Branch:    master

commit 5925364c9ac05e266637183ff91695d06234e3cb
Author: Ihar Hrachyshka <ihrachys@xxxxxxxxxx>
Date:   Sat Aug 13 17:25:07 2016 +0200

    Fixed neutron-db-manage without neutron/tests installed
    
    With 7c0f189309789ebcbd5c20c5a86835576ffb5db3 in tree, we made
    neutron-db-manage require neutron/tests/tools.py installed. Some
    distributions, like RDO, may split the python package into core package
    and the one that contains python code needed for testing only (anything
    under neutron/tests/), and hence don't guarantee that all setups have
    neutron.tests package available.
    
    This fix moves the import_module_recursively function from
    neutron.tests.tools into neutron.common.utils because it has non-testing
    use cases. All existing cases where we use the function switched to the
    new location. The old symbol still works, though triggers a deprecation
    warning, and will be removed in the next cycle.
    
    Change-Id: Ia8d91a1704c894bc1f6cf14e6cdd971fab255b62
    Closes-Bug: #1612959


** 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/1612959

Title:
  neutron DB sync fails: ImportError: No module named tests

Status in neutron:
  Fix Released
Status in openstack-ansible:
  Confirmed

Bug description:
  neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head
  Traceback (most recent call last):
    File "/usr/bin/neutron-db-manage", line 10, in <module>
      sys.exit(main())
    File "/usr/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 686, in main
      return_val |= bool(CONF.command.func(config, CONF.command.name))
    File "/usr/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 205, in do_upgrade
      run_sanity_checks(config, revision)
    File "/usr/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 670, in run_sanity_checks
      script_dir.run_env()
    File "/usr/lib/python2.7/site-packages/alembic/script/base.py", line 397, in run_env
      util.load_python_file(self.dir, 'env.py')
    File "/usr/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file
      module = load_module_py(module_id, path)
    File "/usr/lib/python2.7/site-packages/alembic/util/compat.py", line 79, in load_module_py
      mod = imp.load_source(module_id, path, fp)
    File "/usr/lib/python2.7/site-packages/neutron/db/migration/alembic_migrations/env.py", line 23, in <module>
      from neutron.db.migration.models import head  # noqa
    File "/usr/lib/python2.7/site-packages/neutron/db/migration/models/head.py", line 66, in <module>
      from neutron.tests import tools
  ImportError: No module named tests

  
  -----

  The issue seems to be that in commit we started using code from
  neutron.tests outside of the testing code. Specifically commit
  7c0f189309789ebcbd5c20c5a86835576ffb5db3 now causes it to get used
  during DB sync. Given that some distribution packages don't package up
  the 'tests' code tree I think we shouldn't be using this code.

  See also:

  grep -lir neutron.tests * | grep -v tests
  cmd/sanity/checks.py
  db/migration/models/head.py
  hacking/checks.py

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


References