]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Make manage.py usable
authorMathieu Gagné <mgagne@iweb.com>
Thu, 7 Aug 2014 23:21:49 +0000 (19:21 -0400)
committerMathieu Gagné <mgagne@iweb.com>
Mon, 11 Aug 2014 16:47:02 +0000 (12:47 -0400)
It's not possible to use manage.py in its current state due to
an exception thrown by oslo.config:

  oslo.config.cfg.ArgsAlreadyParsedError:
    arguments already parsed: cannot register CLI option

This exception is a side-effect of including
cinder.openstack.common.logging in most of the migration scripts.

This change therefore suggests removing oslo.config and other imports
from manage.py to make it usable again.

It is now possible to use manage.py:

  tox -evenv -- python cinder/db/sqlalchemy/migrate_repo/manage.py \
    version_control --url=sqlite:///./cinder.db

  tox -evenv -- python cinder/db/sqlalchemy/migrate_repo/manage.py \
    upgrade --url=sqlite:///./cinder.db

Closes-bug: #1355297
Change-Id: I843cfa9a4e4758a6bc8e5c04f064e9d3107b01fa

cinder/db/sqlalchemy/migrate_repo/manage.py

index d12e891882fa7778e9a65e999c2768d0f9a33434..22877d940033e11646da33b1dd327b597bf1d312 100755 (executable)
 
 import os
 
-from oslo.config import cfg
-
-from cinder import i18n
-i18n.enable_lazy()
-
 from cinder.db.sqlalchemy import migrate_repo
-from cinder import version
 
 from migrate.versioning.shell import main
 
-CONF = cfg.CONF
 
 if __name__ == '__main__':
-    CONF([], project='cinder', version=version.version_string())
-    main(debug='False', url=CONF.database.connection,
+    main(debug='False',
          repository=os.path.abspath(os.path.dirname(migrate_repo.__file__)))