mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Do not filter out exception, warnings, deprecations on failure when using debug (#47588)
* Do not filter out exception, warnings, deprecations on failure when using debug. Fixes #47576 * Add changelog fragment
This commit is contained in:
parent
fd662c0a63
commit
40e5d2c951
2 changed files with 7 additions and 2 deletions
2
changelogs/fragments/callback-keep-more-debug-keys.yml
Normal file
2
changelogs/fragments/callback-keep-more-debug-keys.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- callbacks - Do not filter out exception, warnings, deprecations on failure when using debug (https://github.com/ansible/ansible/issues/47576)
|
|
@ -49,6 +49,9 @@ except ImportError:
|
||||||
__all__ = ["CallbackBase"]
|
__all__ = ["CallbackBase"]
|
||||||
|
|
||||||
|
|
||||||
|
_DEBUG_ALLOWED_KEYS = frozenset(('msg', 'exception', 'warnings', 'deprecations'))
|
||||||
|
|
||||||
|
|
||||||
class CallbackBase(AnsiblePlugin):
|
class CallbackBase(AnsiblePlugin):
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
@ -234,11 +237,11 @@ class CallbackBase(AnsiblePlugin):
|
||||||
''' removes data from results for display '''
|
''' removes data from results for display '''
|
||||||
|
|
||||||
# mostly controls that debug only outputs what it was meant to
|
# mostly controls that debug only outputs what it was meant to
|
||||||
if task_name in ['debug']:
|
if task_name == 'debug':
|
||||||
if 'msg' in result:
|
if 'msg' in result:
|
||||||
# msg should be alone
|
# msg should be alone
|
||||||
for key in list(result.keys()):
|
for key in list(result.keys()):
|
||||||
if key != 'msg' and not key.startswith('_'):
|
if key not in _DEBUG_ALLOWED_KEYS and not key.startswith('_'):
|
||||||
result.pop(key)
|
result.pop(key)
|
||||||
else:
|
else:
|
||||||
# 'var' value as field, so eliminate others and what is left should be varname
|
# 'var' value as field, so eliminate others and what is left should be varname
|
||||||
|
|
Loading…
Reference in a new issue