From 3d3ebbf98e20487d457b32f460db26fc2a8bf081 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sat, 15 Oct 2016 11:03:34 -0700 Subject: [PATCH] Fix become password using non-ascii for local connection Fixes #18029 --- lib/ansible/plugins/connection/local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/plugins/connection/local.py b/lib/ansible/plugins/connection/local.py index 728522acda5..537e804689f 100644 --- a/lib/ansible/plugins/connection/local.py +++ b/lib/ansible/plugins/connection/local.py @@ -106,7 +106,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='surrogate_or_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)