From 6f6b5aa90999db43c2b364ac20c456387ef44eea Mon Sep 17 00:00:00 2001 From: Javier Pena Date: Tue, 8 Nov 2016 15:42:20 +0100 Subject: [PATCH] Avoid error if logFile is not defined If there is an error initializing a plugin or checking the command-line arguments, we may use the logFile variable without having initialized it, which causes an exception. In those cases there will be no log file, so let's catch the exception and ignore it if it happens. Change-Id: Icaeb2ae780da9802591e9a063a71dd339b396b93 Closes-Bug: #1635770 --- packstack/installer/run_setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packstack/installer/run_setup.py b/packstack/installer/run_setup.py index 139876df0..15442c92a 100644 --- a/packstack/installer/run_setup.py +++ b/packstack/installer/run_setup.py @@ -1017,7 +1017,10 @@ def main(): except Exception as e: logging.error(traceback.format_exc()) print("\n" + utils.color_text("ERROR : " + str(e), 'red')) - print(output_messages.ERR_CHECK_LOG_FILE_FOR_MORE_INFO % (logFile)) + try: + print(output_messages.ERR_CHECK_LOG_FILE_FOR_MORE_INFO % (logFile)) + except NameError: + pass sys.exit(1) finally: