diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-11-30 22:18:32 -0500 |
---|---|---|
committer | Adam Gandelman <adamg@ubuntu.com> | 2014-12-03 17:51:16 -0800 |
commit | d7ee2ff991e60ad54ff2125a397e9293ba966549 (patch) | |
tree | b15d5415476eb6f7b5b87dedc7c9b304f1549b24 | |
parent | 181310428c8781fe5ffedd80d08b6955cb26524f (diff) | |
download | neutron-d7ee2ff991e60ad54ff2125a397e9293ba966549.tar.gz |
Alter execute_alembic_command() to not assume all commands
Alembic 0.7.1 is adding new diff directives add_fk and remove_fk.
The logic in execute_alembic_command() appears to assume all potential
commands are present in METHODS. This patch adjusts it so that
it checks METHODS first, allowing the tests in neutron.tests.unit.db.test_migration
to pass. However, if the design here requires that all potential
Alembic commands are handled, then this would not be the fix,
though I recommend that the potential list of Alembic directives
not be hardcoded.
Change-Id: Ib08685be252e1fdb0f10853f8fc9a7e19ac54a94
Closes-Bug: #1397796
(cherry picked from commit 6a9d1121472028f3583e577b62a7e576fff5806f)
-rw-r--r-- | neutron/db/migration/alembic_migrations/heal_script.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/neutron/db/migration/alembic_migrations/heal_script.py b/neutron/db/migration/alembic_migrations/heal_script.py index e5bcc22af2..53d0d847f6 100644 --- a/neutron/db/migration/alembic_migrations/heal_script.py +++ b/neutron/db/migration/alembic_migrations/heal_script.py @@ -88,7 +88,8 @@ def execute_alembic_command(command): # Here methods add_table, drop_index, etc is running. Name of method is # the first element of the tuple, arguments to this method comes from # the next element(s). - METHODS[command[0]](*command[1:]) + if command[0] in METHODS: + METHODS[command[0]](*command[1:]) else: # For all commands that changing type, nullable or other parameters # of the column is used alter_column method from alembic. |