now allows for users to use ^D to not input a password

fixes #11413
This commit is contained in:
Brian Coca 2015-07-01 05:21:46 -04:00
parent 4fe2d7fc8d
commit 0a2a9557b8

View file

@ -108,6 +108,7 @@ class CLI(object):
vault_pass = None
new_vault_pass = None
try:
if ask_vault_pass:
vault_pass = getpass.getpass(prompt="Vault password: ")
@ -123,6 +124,8 @@ class CLI(object):
new_vault_pass2 = getpass.getpass(prompt="Confirm New Vault password: ")
if new_vault_pass != new_vault_pass2:
raise errors.AnsibleError("Passwords do not match")
except EOFError:
pass
# enforce no newline chars at the end of passwords
if vault_pass:
@ -141,6 +144,7 @@ class CLI(object):
becomepass = None
become_prompt = ''
try:
if op.ask_pass:
sshpass = getpass.getpass(prompt="SSH password: ")
become_prompt = "%s password[defaults to SSH password]: " % op.become_method.upper()
@ -155,6 +159,8 @@ class CLI(object):
becomepass = sshpass
if becomepass:
becomepass = to_bytes(becomepass)
except EOFError:
pass
return (sshpass, becomepass)