fixed py3 compatibility

pull/14313/head
Brian Coca 9 years ago
parent 70ac47ae61
commit 89c57666c3

@ -1722,8 +1722,9 @@ class AnsibleModule(object):
out_dest.close() out_dest.close()
if in_src: if in_src:
in_src.close() in_src.close()
except (shutil.Error, OSError, IOError), e: except (shutil.Error, OSError, IOError):
self.fail_json(msg='Could not write data to file (%s) from (%s): %s' % (dest, src, e)) e = get_exception()
self.fail_json(msg='Could not write data to file (%s) from (%s): %s' % (dest, src, e))
elif e.errno not in [errno.EPERM, errno.EXDEV, errno.EACCES, errno.ETXTBSY]: elif e.errno not in [errno.EPERM, errno.EXDEV, errno.EACCES, errno.ETXTBSY]:
# only try workarounds for errno 18 (cross device), 1 (not permitted), 13 (permission denied) # only try workarounds for errno 18 (cross device), 1 (not permitted), 13 (permission denied)
# and 26 (text file busy) which happens on vagrant synced folders and other 'exotic' non posix file systems # and 26 (text file busy) which happens on vagrant synced folders and other 'exotic' non posix file systems

Loading…
Cancel
Save