summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2016-10-15 11:03:34 -0700
committerToshio Kuratomi <a.badger@gmail.com>2016-10-15 11:29:51 -0700
commit264b33da6bdca865f87f372169a1c9ff3246d7f4 (patch)
tree479f35913733222665c810516287ddad997c70ff
parent3e58f0815502c2bec8aab9994cf29cf7a837a06a (diff)
downloadansible-264b33da6bdca865f87f372169a1c9ff3246d7f4.tar.gz
Fix become password using non-ascii for local connection
Fixes #18029 (cherry picked from commit efc5dac52cdfab25c3b163958830325f6898d3b6) In 2.1, the to_bytes function doesn't have a surrogate_or_strict error handler
-rw-r--r--lib/ansible/plugins/connection/local.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ansible/plugins/connection/local.py b/lib/ansible/plugins/connection/local.py
index 0c7bb5ccb7..ce06c6d910 100644
--- a/lib/ansible/plugins/connection/local.py
+++ b/lib/ansible/plugins/connection/local.py
@@ -105,7 +105,7 @@ class Connection(ConnectionBase):
raise AnsibleError('privilege output closed while waiting for password prompt:\n' + become_output)
become_output += chunk
if not self.check_become_success(become_output):
- p.stdin.write(self._play_context.become_pass + '\n')
+ p.stdin.write(to_bytes(self._play_context.become_pass, errors='strict') + b'\n')
fcntl.fcntl(p.stdout, fcntl.F_SETFL, fcntl.fcntl(p.stdout, fcntl.F_GETFL) & ~os.O_NONBLOCK)
fcntl.fcntl(p.stderr, fcntl.F_SETFL, fcntl.fcntl(p.stderr, fcntl.F_GETFL) & ~os.O_NONBLOCK)