From 18f07e828e67c98c089ed282bc15f0644cd56606 Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Tue, 23 Oct 2018 12:27:01 -0400 Subject: [PATCH] [2.7] escape default prompt detection in telnet action plugin (#46573) (#47440) * [2.7] escape default prompt detection in telnet action plugin (#46573) This change fixes an issue with the default prompt handling. The value needs to be escaped otherwise it does not work when converted to bytes. (cherry picked from commit 9180d2c) Co-authored-by: Peter Sprygada * Add changelog --- changelogs/fragments/telent-prompt-fix.yaml | 4 ++++ lib/ansible/plugins/action/telnet.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/telent-prompt-fix.yaml diff --git a/changelogs/fragments/telent-prompt-fix.yaml b/changelogs/fragments/telent-prompt-fix.yaml new file mode 100644 index 00000000000..12684b287f8 --- /dev/null +++ b/changelogs/fragments/telent-prompt-fix.yaml @@ -0,0 +1,4 @@ +--- +bugfixes: +- Fix an issue with the default telnet prompt handling. The value needs to be + escaped otherwise it does not work when converted to bytes. diff --git a/lib/ansible/plugins/action/telnet.py b/lib/ansible/plugins/action/telnet.py index 201f3bb0380..63b3870c34e 100644 --- a/lib/ansible/plugins/action/telnet.py +++ b/lib/ansible/plugins/action/telnet.py @@ -51,7 +51,7 @@ class ActionModule(ActionBase): login_prompt = self._task.args.get('login_prompt', "login: ") password_prompt = self._task.args.get('password_prompt', "Password: ") - prompts = self._task.args.get('prompts', ["$ "]) + prompts = self._task.args.get('prompts', ["\\$ "]) commands = self._task.args.get('command') or self._task.args.get('commands') if isinstance(commands, text_type):