mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Add a config toggle for agnostic become prompts, defaulting to False for the 2.5 release. Fixes #33999 (#34761)
This commit is contained in:
parent
7957ba7aad
commit
2b66d9966c
2 changed files with 15 additions and 2 deletions
|
@ -320,14 +320,16 @@ class CLI(with_metaclass(ABCMeta, object)):
|
|||
becomepass = None
|
||||
become_prompt = ''
|
||||
|
||||
become_prompt_method = "BECOME" if C.AGNOSTIC_BECOME_PROMPT else op.become_method.upper()
|
||||
|
||||
try:
|
||||
if op.ask_pass:
|
||||
sshpass = getpass.getpass(prompt="SSH password: ")
|
||||
become_prompt = "BECOME password[defaults to SSH password]: "
|
||||
become_prompt = "%s password[defaults to SSH password]: " % become_prompt_method
|
||||
if sshpass:
|
||||
sshpass = to_bytes(sshpass, errors='strict', nonstring='simplerepr')
|
||||
else:
|
||||
become_prompt = "BECOME password: "
|
||||
become_prompt = "%s password: " % become_prompt_method
|
||||
|
||||
if op.become_ask_pass:
|
||||
becomepass = getpass.getpass(prompt=become_prompt)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue