auto tb on vvv+ or debug (#26106)

* auto tb on vvv+ or debug

* updated as per feedback
pull/26185/head
Brian Coca 7 years ago committed by GitHub
parent 11836a0296
commit d5f4c2a54b

@ -2134,6 +2134,11 @@ class AnsibleModule(object):
if 'changed' not in kwargs:
kwargs['changed'] = False
# add traceback if debug or high verbosity and it is missing
# Note: badly named as exception, it is really always been 'traceback'
if 'exception' not in kwargs and sys.exc_info()[2] and (self._debug or self._verbosity >= 3):
kwargs['exception'] = ''.join(traceback.format_tb(sys.exc_info()[2]))
self.do_cleanup_files()
self._return_formatted(kwargs)
sys.exit(1)

Loading…
Cancel
Save