mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 14:41:23 -07:00
Revert "Make ansible doesn't parse template-like password in user's input (#42275)"
This reverts commit de40ac02a5
.
Passwords from the cli need to remain bytes on input otherwise we have
encoding problems when users input non-utf8
This commit is contained in:
parent
a37f27a243
commit
ccbac66128
1 changed files with 2 additions and 3 deletions
|
@ -38,7 +38,6 @@ from ansible.errors import AnsibleOptionsError, AnsibleError
|
||||||
from ansible.inventory.manager import InventoryManager
|
from ansible.inventory.manager import InventoryManager
|
||||||
from ansible.module_utils.six import with_metaclass, string_types
|
from ansible.module_utils.six import with_metaclass, string_types
|
||||||
from ansible.module_utils._text import to_bytes, to_text
|
from ansible.module_utils._text import to_bytes, to_text
|
||||||
from ansible.utils.unsafe_proxy import AnsibleUnsafeText
|
|
||||||
from ansible.parsing.dataloader import DataLoader
|
from ansible.parsing.dataloader import DataLoader
|
||||||
from ansible.release import __version__
|
from ansible.release import __version__
|
||||||
from ansible.utils.path import unfrackpath
|
from ansible.utils.path import unfrackpath
|
||||||
|
@ -330,7 +329,7 @@ class CLI(with_metaclass(ABCMeta, object)):
|
||||||
sshpass = getpass.getpass(prompt="SSH password: ")
|
sshpass = getpass.getpass(prompt="SSH password: ")
|
||||||
become_prompt = "%s password[defaults to SSH password]: " % become_prompt_method
|
become_prompt = "%s password[defaults to SSH password]: " % become_prompt_method
|
||||||
if sshpass:
|
if sshpass:
|
||||||
sshpass = AnsibleUnsafeText(to_bytes(sshpass, errors='strict', nonstring='simplerepr'))
|
sshpass = to_bytes(sshpass, errors='strict', nonstring='simplerepr')
|
||||||
else:
|
else:
|
||||||
become_prompt = "%s password: " % become_prompt_method
|
become_prompt = "%s password: " % become_prompt_method
|
||||||
|
|
||||||
|
@ -339,7 +338,7 @@ class CLI(with_metaclass(ABCMeta, object)):
|
||||||
if op.ask_pass and becomepass == '':
|
if op.ask_pass and becomepass == '':
|
||||||
becomepass = sshpass
|
becomepass = sshpass
|
||||||
if becomepass:
|
if becomepass:
|
||||||
becomepass = AnsibleUnsafeText(to_bytes(becomepass))
|
becomepass = to_bytes(becomepass)
|
||||||
except EOFError:
|
except EOFError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue