mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
auto tb on vvv+ or debug (#26106)
* auto tb on vvv+ or debug * updated as per feedback
This commit is contained in:
parent
11836a0296
commit
d5f4c2a54b
1 changed files with 5 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue