mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02: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)
|
||||
|
|
|
@ -159,6 +159,17 @@ BECOME_ALLOW_SAME_USER:
|
|||
- {key: become_allow_same_user, section: privilege_escalation}
|
||||
type: boolean
|
||||
yaml: {key: privilege_escalation.become_allow_same_user}
|
||||
AGNOSTIC_BECOME_PROMPT:
|
||||
# TODO: Switch the default to True in either the Ansible 2.6 release or the 2.7 release, whichever happens after the Tower 3.3 release
|
||||
name: Display an agnostic become prompt
|
||||
default: False
|
||||
type: boolean
|
||||
description: Display an agnostic become prompt instead of displaying a prompt containing the command line supplied become method
|
||||
env: [{name: ANSIBLE_AGNOSTIC_BECOME_PROMPT}]
|
||||
ini:
|
||||
- {key: agnostic_become_prompt, section: privilege_escalation}
|
||||
yaml: {key: privilege_escalation.agnostic_become_prompt}
|
||||
version_added: "2.5"
|
||||
CACHE_PLUGIN:
|
||||
name: Persistent Cache plugin
|
||||
default: memory
|
||||
|
|
Loading…
Reference in a new issue