From 1156014d9c0b99d17ee1e97e01c80e23140efbdc Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 5 Nov 2018 13:30:56 -0800 Subject: [PATCH] Fix regression in synchronize when using ssh passwords The change to add sshpass support for rsync broke synchronize when a password was provided at all. Have to convert an int into a string to make it work. --- lib/ansible/modules/files/synchronize.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/files/synchronize.py b/lib/ansible/modules/files/synchronize.py index 49adc4d0b3..8737986f82 100644 --- a/lib/ansible/modules/files/synchronize.py +++ b/lib/ansible/modules/files/synchronize.py @@ -321,7 +321,8 @@ EXAMPLES = ''' import os import errno -from ansible.module_utils.basic import AnsibleModule, to_bytes +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_bytes, to_native from ansible.module_utils.six.moves import shlex_quote @@ -440,7 +441,7 @@ def main(): msg="to use rsync connection with passwords, you must install the sshpass program" ) _sshpass_pipe = os.pipe() - cmd = ['sshpass', '-d' + _sshpass_pipe[0]] + cmd + cmd = ['sshpass', '-d' + to_native(_sshpass_pipe[0], errors='surrogate_or_strict')] + cmd if compress: cmd.append('--compress') if rsync_timeout: