From fdb85e3da8594197d3446a0e60bba23cbdbea150 Mon Sep 17 00:00:00 2001 From: Bernardo Dal Seno <bdalseno@google.com> Date: Wed, 20 Mar 2013 14:24:49 +0100 Subject: [PATCH] cfgupgrade: Fix error messages Messages were inconsistent. You could get both an error and a message saying that everything was fine. Signed-off-by: Bernardo Dal Seno <bdalseno@google.com> Reviewed-by: Helga Velroyen <helgav@google.com> --- tools/cfgupgrade | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/cfgupgrade b/tools/cfgupgrade index 4fa49d98b..56b36fc8f 100755 --- a/tools/cfgupgrade +++ b/tools/cfgupgrade @@ -1,7 +1,7 @@ #!/usr/bin/python # -# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Google Inc. +# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -334,6 +334,7 @@ def main(): raise # test loading the config file + all_ok = True if not (options.dry_run or options.no_verify): logging.info("Testing the new config file...") cfg = config.ConfigWriter(cfg_file=options.CONFIG_DATA_PATH, @@ -345,11 +346,17 @@ def main(): logging.error("Errors after conversion:") for item in vrfy: logging.error(" - %s", item) + all_ok = False + else: + logging.info("File loaded successfully after upgrading") del cfg - logging.info("File loaded successfully") - cli.ToStderr("Configuration successfully upgraded for version %s.", - constants.RELEASE_VERSION) + if all_ok: + cli.ToStderr("Configuration successfully upgraded to version %s.", + constants.RELEASE_VERSION) + else: + cli.ToStderr("Configuration upgraded to version %s, but there are errors." + "\nPlease review the file.", constants.RELEASE_VERSION) if __name__ == "__main__": -- GitLab