Fix ios terminal regex for privilege escalation (#62479)

Fixes https://github.com/ansible/ansible/issues/61726

*  On some ios versions the passwrod prompt for enable
   command differs. Modify the regex to work with multiple
   password prompt patterns
   1) password:
   2) Password:
   3) Local_Password:
   4) Enter Local Password:
This commit is contained in:
Ganesh Nalawade 2019-09-23 15:14:47 +05:30 committed by GitHub
parent 0530a08b67
commit bd8097ea91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,7 +76,7 @@ class TerminalModule(TerminalBase):
if passwd:
# Note: python-3.5 cannot combine u"" and r"" together. Thus make
# an r string and use to_text to ensure it's text on both py2 and py3.
cmd[u'prompt'] = to_text(r"[\r\n](?:Local_)?[Pp]assword: ?$", errors='surrogate_or_strict')
cmd[u'prompt'] = to_text(r"[\r\n]?(?:Local[_| ])?[Pp]assword: ?$", errors='surrogate_or_strict')
cmd[u'answer'] = passwd
cmd[u'prompt_retry_check'] = True
try: