Fix become password using non-ascii for local connection

Fixes #18029

(cherry picked from commit efc5dac52c)

In 2.1, the to_bytes function doesn't have a surrogate_or_strict error handler
pull/18120/head
Toshio Kuratomi 8 years ago
parent 3e58f08155
commit 264b33da6b

@ -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)

Loading…
Cancel
Save