Refactor redundant exception type checking
We can identify the exception class by 'except <ExceptionClass>' so we don't need to check in inside except block. Change-Id: Ib4f3a47b6f1121b1c753d06bd42e74c9a0762eac
This commit is contained in:
parent
44423a930c
commit
ede75ea10c
|
@ -1419,15 +1419,14 @@ class Deploy(command.Command):
|
|||
).lower()
|
||||
if not prompt_response.startswith('y'):
|
||||
raise exceptions.UndercloudUpgradeNotConfirmed(unconf_msg)
|
||||
except (KeyboardInterrupt, EOFError) as e:
|
||||
if e.__class__ == KeyboardInterrupt:
|
||||
# ctrl-c
|
||||
raise exceptions.UndercloudUpgradeNotConfirmed("(ctrl-c) %s" %
|
||||
unconf_msg)
|
||||
else:
|
||||
# ctrl-d
|
||||
raise exceptions.UndercloudUpgradeNotConfirmed("(ctrl-d) %s" %
|
||||
unconf_msg)
|
||||
except KeyboardInterrupt:
|
||||
# ctrl-c
|
||||
raise exceptions.UndercloudUpgradeNotConfirmed("(ctrl-c) %s" %
|
||||
unconf_msg)
|
||||
except EOFError:
|
||||
# ctrl-d
|
||||
raise exceptions.UndercloudUpgradeNotConfirmed("(ctrl-d) %s" %
|
||||
unconf_msg)
|
||||
|
||||
try:
|
||||
if parsed_args.standalone:
|
||||
|
|
Loading…
Reference in New Issue