diff options
author | Andrew Melton <andrew.melton@rackspace.com> | 2015-08-19 09:57:46 -0700 |
---|---|---|
committer | Andrew Melton <andrew.melton@rackspace.com> | 2015-08-19 10:00:27 -0700 |
commit | 27b730143886c3699ed0b072ea2304e47bff9c2d (patch) | |
tree | c7a653a0363048bb868360fccb95350bf4d6538f | |
parent | 4e83ad8299182d1e8a1b0600c0722d4754180487 (diff) | |
download | oslo-db-27b730143886c3699ed0b072ea2304e47bff9c2d.tar.gz |
Use correct config key in alembic extension
While the value we're looking for is passed into the Extension as
'alembic_repo_path' it is actually stored in the alembic config as
'script_location'. This change fixes the call to the alembic config
and retrieves 'script_location' instead.
Change-Id: Ia328e8230d33dc063c0d377e04f15f1ccaa4d500
Closes-Bug: #1486655
-rw-r--r-- | oslo_db/sqlalchemy/migration_cli/ext_alembic.py | 2 | ||||
-rw-r--r-- | oslo_db/tests/sqlalchemy/test_migrate_cli.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/oslo_db/sqlalchemy/migration_cli/ext_alembic.py b/oslo_db/sqlalchemy/migration_cli/ext_alembic.py index 825c638..0348a37 100644 --- a/oslo_db/sqlalchemy/migration_cli/ext_alembic.py +++ b/oslo_db/sqlalchemy/migration_cli/ext_alembic.py @@ -95,7 +95,7 @@ class AlembicExtension(ext_base.MigrationExtensionBase): if rev_id in ['base', 'head']: return True script = alembic_script.ScriptDirectory( - self.config.get_main_option('alembic_repo_path')) + self.config.get_main_option('script_location')) try: script.get_revision(rev_id) return True diff --git a/oslo_db/tests/sqlalchemy/test_migrate_cli.py b/oslo_db/tests/sqlalchemy/test_migrate_cli.py index 6bdb09a..72d8b4e 100644 --- a/oslo_db/tests/sqlalchemy/test_migrate_cli.py +++ b/oslo_db/tests/sqlalchemy/test_migrate_cli.py @@ -103,6 +103,8 @@ class TestAlembicExtension(test_base.BaseTestCase): # since alembic_script is mocked and no exception is raised, call # will result in success self.assertIs(True, self.alembic.has_revision('test')) + self.alembic.config.get_main_option.assert_called_once_with( + 'script_location') mocked.ScriptDirectory().get_revision.assert_called_once_with( 'test') self.assertIs(True, self.alembic.has_revision(None)) @@ -116,6 +118,8 @@ class TestAlembicExtension(test_base.BaseTestCase): self.alembic.config.get_main_option = mock.Mock() # exception is raised, the call should be false self.assertIs(False, self.alembic.has_revision('test')) + self.alembic.config.get_main_option.assert_called_once_with( + 'script_location') mocked.ScriptDirectory().get_revision.assert_called_once_with( 'test') |