Add traceback information to fail_json in atomic move
This commit is contained in:
parent
af8cce53ff
commit
70e42f917d
1 changed files with 5 additions and 5 deletions
|
@ -2055,7 +2055,7 @@ class AnsibleModule(object):
|
||||||
if e.errno not in [errno.EPERM, errno.EXDEV, errno.EACCES, errno.ETXTBSY, errno.EBUSY]:
|
if e.errno not in [errno.EPERM, errno.EXDEV, errno.EACCES, errno.ETXTBSY, errno.EBUSY]:
|
||||||
# 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
|
||||||
self.fail_json(msg='Could not replace file: %s to %s: %s' % (src, dest, e))
|
self.fail_json(msg='Could not replace file: %s to %s: %s' % (src, dest, e), exception=traceback.format_exc())
|
||||||
else:
|
else:
|
||||||
b_dest_dir = os.path.dirname(b_dest)
|
b_dest_dir = os.path.dirname(b_dest)
|
||||||
# Use bytes here. In the shippable CI, this fails with
|
# Use bytes here. In the shippable CI, this fails with
|
||||||
|
@ -2075,7 +2075,7 @@ class AnsibleModule(object):
|
||||||
# would end in something like:
|
# would end in something like:
|
||||||
# file = _os.path.join(dir, pre + name + suf)
|
# file = _os.path.join(dir, pre + name + suf)
|
||||||
# TypeError: can't concat bytes to str
|
# TypeError: can't concat bytes to str
|
||||||
self.fail_json(msg='Failed creating temp file for atomic move. This usually happens when using Python3 less than Python3.5. Please use Python2.x or Python3.5 or greater.', exception=sys.exc_info())
|
self.fail_json(msg='Failed creating temp file for atomic move. This usually happens when using Python3 less than Python3.5. Please use Python2.x or Python3.5 or greater.', exception=traceback.format_exc())
|
||||||
|
|
||||||
b_tmp_dest_name = to_bytes(tmp_dest_name, errors='surrogate_or_strict')
|
b_tmp_dest_name = to_bytes(tmp_dest_name, errors='surrogate_or_strict')
|
||||||
|
|
||||||
|
@ -2108,10 +2108,10 @@ class AnsibleModule(object):
|
||||||
if unsafe_writes and e.errno == errno.EBUSY:
|
if unsafe_writes and e.errno == errno.EBUSY:
|
||||||
self._unsafe_writes(b_tmp_dest_name, b_dest)
|
self._unsafe_writes(b_tmp_dest_name, b_dest)
|
||||||
else:
|
else:
|
||||||
self.fail_json(msg='Unable to rename file: %s to %s: %s' % (src, dest, e))
|
self.fail_json(msg='Unable to rename file: %s to %s: %s' % (src, dest, e), exception=traceback.format_exc())
|
||||||
except (shutil.Error, OSError, IOError):
|
except (shutil.Error, OSError, IOError):
|
||||||
e = get_exception()
|
e = get_exception()
|
||||||
self.fail_json(msg='Failed to replace file: %s to %s: %s' % (src, dest, e))
|
self.fail_json(msg='Failed to replace file: %s to %s: %s' % (src, dest, e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
self.cleanup(b_tmp_dest_name)
|
self.cleanup(b_tmp_dest_name)
|
||||||
|
|
||||||
|
@ -2143,7 +2143,7 @@ class AnsibleModule(object):
|
||||||
in_src.close()
|
in_src.close()
|
||||||
except (shutil.Error, OSError, IOError):
|
except (shutil.Error, OSError, IOError):
|
||||||
e = get_exception()
|
e = get_exception()
|
||||||
self.fail_json(msg='Could not write data to file (%s) from (%s): %s' % (dest, src, e))
|
self.fail_json(msg='Could not write data to file (%s) from (%s): %s' % (dest, src, e), exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
def _read_from_pipes(self, rpipes, rfds, file_descriptor):
|
def _read_from_pipes(self, rpipes, rfds, file_descriptor):
|
||||||
|
|
Loading…
Reference in a new issue