Handle KeyboardInterrupt on password prompt
If the user interrupts the password prompt manually the error message is not handling and the output is the error traceback. This commits change it to output a better message. Test Plan: PASS - Interrupts password prompt using dcmanager subcloub-backup (create/delete/restore) without --sysadmin-password parameter. Story: 2010116 Task: 46165 Signed-off-by: Hugo Brito <hugo.brito@windriver.com> Change-Id: I51ba0e77abc90872fb0ac832f18bc9ca2c9c5828
This commit is contained in:
parent
2f842d5ba7
commit
6c4114a3e6
@ -89,6 +89,7 @@ def get_contents_if_file(contents_or_file_name):
|
||||
|
||||
def prompt_for_password(password_type='sysadmin'):
|
||||
while True:
|
||||
try:
|
||||
password = getpass.getpass(
|
||||
"Enter the " + password_type + " password for the subcloud: ")
|
||||
if len(password) < 1:
|
||||
@ -101,4 +102,8 @@ def prompt_for_password(password_type='sysadmin'):
|
||||
print("Passwords did not match")
|
||||
continue
|
||||
break
|
||||
except KeyboardInterrupt:
|
||||
raise exceptions.DCManagerClientException(
|
||||
"\nPassword prompt interrupted."
|
||||
)
|
||||
return password
|
||||
|
Loading…
x
Reference in New Issue
Block a user