From 56c3c8b38210662a047cd385094b40aac5f15f36 Mon Sep 17 00:00:00 2001 From: Cedric Brandily Date: Tue, 7 Jul 2015 12:23:12 +0000 Subject: [PATCH] Improve check_migration command error message 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/neutron/db/migration/cli.py b/neutron/db/migration/cli.py index 11406eeaa..51b49508a 100644 --- a/neutron/db/migration/cli.py +++ b/neutron/db/migration/cli.py @@ -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): -- 2.45.2