UnboundLocalError: local variable 'logFile' referenced before assignment
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Packstack |
Fix Released
|
Medium
|
Javier Peña |
Bug Description
code in run_setup.py:main() is:
def main():
options = ""
try:
# Load Plugins
optParser = initCmdLineParser()
# Do the actual command line parsing
# Try/Except are here to catch the silly sys.exit(0) when calling rhevm-setup --help
(options, args) = optParser.
if options.options:
raise SystemExit
# Initialize logging
logFile = initLogging(
# Parse parameters
confFile = None
....
except FlagValidationError as ex:
except Exception as e:
print("\n" + utils.color_
sys.exit(1)
finally:
when some exception raised at optParser.
Changed in packstack: | |
assignee: | nobody → gs-opencos-zte (gs-opencos-zte) |
Changed in packstack: | |
importance: | Undecided → Medium |
status: | New → In Progress |
assignee: | gs-opencos-zte (gs-opencos-zte) → Javier Peña (jpena-c) |
Reviewed: https:/ /review. openstack. org/394996 /git.openstack. org/cgit/ openstack/ packstack/ commit/ ?id=6f6b5aa9099 9db43c2b364ac20 c456387ef44eea
Committed: https:/
Submitter: Jenkins
Branch: master
commit 6f6b5aa90999db4 3c2b364ac20c456 387ef44eea
Author: Javier Pena <email address hidden>
Date: Tue Nov 8 15:42:20 2016 +0100
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: Icaeb2ae780da98 02591e9a063a71d d339b396b93
Closes-Bug: #1635770