From: Cedric Brandily Date: Tue, 7 Jul 2015 12:23:12 +0000 (+0000) Subject: Improve check_migration command error message X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=56c3c8b38210662a047cd385094b40aac5f15f36;p=openstack-build%2Fneutron-build.git 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 --- 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):