]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Improve check_migration command error message
authorCedric Brandily <zzelle@gmail.com>
Tue, 7 Jul 2015 12:23:12 +0000 (12:23 +0000)
committerCedric Brandily <zzelle@gmail.com>
Wed, 15 Jul 2015 09:50:26 +0000 (09:50 +0000)
This change adds some details (expected heads) to the error raised by
neutron-db-manage check_migration command in order to help debugging.

Change-Id: Icfc6fc5722b5a3b7c4a36131553eeba0941d12e3

neutron/db/migration/cli.py

index 11406eeaa2d3193a47be485fcb3bb735146db3a9..51b49508a26b6d628f0d769c7e95bce9fb12a90d 100644 (file)
@@ -163,15 +163,18 @@ def _get_sorted_heads(script):
 def validate_heads_file(config):
     '''Check that HEADS file contains the latest heads for each branch.'''
     script = alembic_script.ScriptDirectory.from_config(config)
-    heads = _get_sorted_heads(script)
+    expected_heads = _get_sorted_heads(script)
     heads_path = _get_heads_file_path(CONF)
     try:
         with open(heads_path) as file_:
-            if file_.read().split() == heads:
+            observed_heads = file_.read().split()
+            if observed_heads == expected_heads:
                 return
     except IOError:
         pass
-    alembic_util.err(_('HEADS file does not match migration timeline heads'))
+    alembic_util.err(
+        _('HEADS file does not match migration timeline heads, expected: %s')
+        % ', '.join(expected_heads))
 
 
 def update_heads_file(config):