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
This commit is contained in:
Javier Pena 2016-11-08 15:42:20 +01:00
parent 8862c675c8
commit 6f6b5aa909

View File

@ -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: