mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-12 11:51:10 +00:00
auto tb on vvv+ or debug (#26106)
* auto tb on vvv+ or debug * updated as per feedback
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user