summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2016-10-24 14:33:47 -0700
committerToshio Kuratomi <a.badger@gmail.com>2016-10-24 16:55:54 -0700
commit188ae18b1c3e324a433aa84977cebdbc2ef55615 (patch)
tree62b27521ef0e03eb3b5cd2079b8ebc7b7cb97012
parent236c923c25c053b0ff912f328e87da2dd26cbf69 (diff)
downloadansible-188ae18b1c3e324a433aa84977cebdbc2ef55615.tar.gz
Add a new potential su prompt
Two parts to this change: * Add a new string that requests password * Add a new glyph that can be used to separate the prompt from the user's input as it seems it can use fullwidth colon rather than colon. Fixes #17867
-rw-r--r--lib/ansible/playbook/play_context.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py
index d778aa63c5..f5b9434200 100644
--- a/lib/ansible/playbook/play_context.py
+++ b/lib/ansible/playbook/play_context.py
@@ -117,6 +117,7 @@ b_SU_PROMPT_LOCALIZATIONS = [
to_bytes('හස්පදය'),
to_bytes('密码'),
to_bytes('密碼'),
+ to_bytes('口令'),
]
TASK_ATTRIBUTE_OVERRIDES = (
@@ -510,7 +511,10 @@ class PlayContext(Base):
# passing code ref to examine prompt as simple string comparisson isn't good enough with su
def detect_su_prompt(b_data):
- b_SU_PROMPT_LOCALIZATIONS_RE = re.compile(b"|".join([b'(\w+\'s )?' + x + b' ?: ?' for x in b_SU_PROMPT_LOCALIZATIONS]), flags=re.IGNORECASE)
+ b_password_string = b"|".join([b'(\w+\'s )?' + x for x in b_SU_PROMPT_LOCALIZATIONS])
+ # Colon or unicode fullwidth colon
+ b_password_string = b_password_string + to_bytes(u' ?(:|:) ?')
+ b_SU_PROMPT_LOCALIZATIONS_RE = re.compile(b_password_string, flags=re.IGNORECASE)
return bool(b_SU_PROMPT_LOCALIZATIONS_RE.match(b_data))
prompt = detect_su_prompt