From c0e2dd16933f59c49e9fd46bb5512a41f33b08bf Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 9 Mar 2016 11:17:10 -0800 Subject: [PATCH] Fix ssh connection plugin to work with python3 --- lib/ansible/plugins/connection/ssh.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py index c24a5623ed3..56acd57afb2 100644 --- a/lib/ansible/plugins/connection/ssh.py +++ b/lib/ansible/plugins/connection/ssh.py @@ -323,7 +323,7 @@ class Connection(ConnectionBase): if isinstance(cmd, (text_type, binary_type)): cmd = to_bytes(cmd) else: - cmd = map(to_bytes, cmd) + cmd = list(map(to_bytes, cmd)) if not in_data: try: @@ -585,7 +585,7 @@ class Connection(ConnectionBase): remaining_tries = int(C.ANSIBLE_SSH_RETRIES) + 1 cmd_summary = "%s..." % args[0] - for attempt in xrange(remaining_tries): + for attempt in range(remaining_tries): try: return_tuple = self._exec_command(*args, **kwargs) # 0 = success