diff --git a/lib/ansible/plugins/connections/chroot.py b/lib/ansible/plugins/connections/chroot.py index 7e3cbe3353..f7b2cb962c 100644 --- a/lib/ansible/plugins/connections/chroot.py +++ b/lib/ansible/plugins/connections/chroot.py @@ -140,8 +140,10 @@ class Connection(object): with open(out_path, 'wb+') as out_file: try: - for chunk in p.stdout.read(BUFSIZE): + chunk = p.stdout.read(BUFSIZE) + while chunk: out_file.write(chunk) + chunk = p.stdout.read(BUFSIZE) except: traceback.print_exc() raise errors.AnsibleError("failed to transfer file %s to %s" % (in_path, out_path)) diff --git a/lib/ansible/plugins/connections/jail.py b/lib/ansible/plugins/connections/jail.py index 0c8c9def27..480a844151 100644 --- a/lib/ansible/plugins/connections/jail.py +++ b/lib/ansible/plugins/connections/jail.py @@ -162,8 +162,10 @@ class Connection(object): with open(out_path, 'wb+') as out_file: try: - for chunk in p.stdout.read(BUFSIZE): + chunk = p.stdout.read(BUFSIZE) + while chunk: out_file.write(chunk) + chunk = p.stdout.read(BUFSIZE) except: traceback.print_exc() raise errors.AnsibleError("failed to transfer file %s to %s" % (in_path, out_path)) diff --git a/lib/ansible/plugins/connections/zone.py b/lib/ansible/plugins/connections/zone.py index 7e6fa5fe60..e4dfedc9e4 100644 --- a/lib/ansible/plugins/connections/zone.py +++ b/lib/ansible/plugins/connections/zone.py @@ -177,8 +177,10 @@ class Connection(object): with open(out_path, 'wb+') as out_file: try: - for chunk in p.stdout.read(BUFSIZE): + chunk = p.stdout.read(BUFSIZE) + while chunk: out_file.write(chunk) + chunk = p.stdout.read(BUFSIZE) except: traceback.print_exc() raise errors.AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))