diff options
author | Nathaniel Case <this.is@nathanielca.se> | 2018-10-23 12:27:01 -0400 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2018-10-23 09:27:01 -0700 |
commit | 18f07e828e67c98c089ed282bc15f0644cd56606 (patch) | |
tree | 6e3f9a9d68180b3ac2daeedb484a7aa1779a52ef | |
parent | a9128b9fb0fef93561ab8431f9015da89fed1b7e (diff) | |
download | ansible-18f07e828e67c98c089ed282bc15f0644cd56606.tar.gz |
[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 <privateip@users.noreply.github.com>
* Add changelog
-rw-r--r-- | changelogs/fragments/telent-prompt-fix.yaml | 4 | ||||
-rw-r--r-- | lib/ansible/plugins/action/telnet.py | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/changelogs/fragments/telent-prompt-fix.yaml b/changelogs/fragments/telent-prompt-fix.yaml new file mode 100644 index 0000000000..12684b287f --- /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 201f3bb038..63b3870c34 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): |