Fix fetch_file() method

pull/11370/head
Toshio Kuratomi 10 years ago
parent d0d9be30d5
commit e461241d7b

@ -140,8 +140,10 @@ class Connection(object):
with open(out_path, 'wb+') as out_file: with open(out_path, 'wb+') as out_file:
try: try:
for chunk in p.stdout.read(BUFSIZE): chunk = p.stdout.read(BUFSIZE)
while chunk:
out_file.write(chunk) out_file.write(chunk)
chunk = p.stdout.read(BUFSIZE)
except: except:
traceback.print_exc() traceback.print_exc()
raise errors.AnsibleError("failed to transfer file %s to %s" % (in_path, out_path)) raise errors.AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))

@ -162,8 +162,10 @@ class Connection(object):
with open(out_path, 'wb+') as out_file: with open(out_path, 'wb+') as out_file:
try: try:
for chunk in p.stdout.read(BUFSIZE): chunk = p.stdout.read(BUFSIZE)
while chunk:
out_file.write(chunk) out_file.write(chunk)
chunk = p.stdout.read(BUFSIZE)
except: except:
traceback.print_exc() traceback.print_exc()
raise errors.AnsibleError("failed to transfer file %s to %s" % (in_path, out_path)) raise errors.AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))

@ -177,8 +177,10 @@ class Connection(object):
with open(out_path, 'wb+') as out_file: with open(out_path, 'wb+') as out_file:
try: try:
for chunk in p.stdout.read(BUFSIZE): chunk = p.stdout.read(BUFSIZE)
while chunk:
out_file.write(chunk) out_file.write(chunk)
chunk = p.stdout.read(BUFSIZE)
except: except:
traceback.print_exc() traceback.print_exc()
raise errors.AnsibleError("failed to transfer file %s to %s" % (in_path, out_path)) raise errors.AnsibleError("failed to transfer file %s to %s" % (in_path, out_path))

Loading…
Cancel
Save