mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 23:44:00 -07:00
fixes for stripping (#52930)
function changed to do in place replacement, should be less expensive even with copy as it avoids 'sub copies', can compose with module_args_copy to create replacement for old behavior attempt to fix #52910 * handle lists and subdicts correctly * added missing exception case, which was not noticed since 'cleaning' was not working * added comments to clarify exceptions
This commit is contained in:
parent
7a387e216e
commit
b793f08a92
11 changed files with 83 additions and 47 deletions
|
@ -13,6 +13,14 @@ _IGNORE = ('failed', 'skipped')
|
|||
_PRESERVE = ('attempts', 'changed', 'retries')
|
||||
_SUB_PRESERVE = {'_ansible_delegated_vars': ('ansible_host', 'ansible_port', 'ansible_user', 'ansible_connection')}
|
||||
|
||||
# stuff callbacks need
|
||||
CLEAN_EXCEPTIONS = (
|
||||
'_ansible_verbose_always', # for debug and other actions, to always expand data (pretty jsonification)
|
||||
'_ansible_item_label', # to know actual 'item' variable
|
||||
'_ansible_no_log', # jic we didnt clean up well enough, DON'T LOG
|
||||
'_ansible_verbose_override', # controls display of ansible_facts, gathering would be very noise with -v otherwise
|
||||
)
|
||||
|
||||
|
||||
class TaskResult:
|
||||
'''
|
||||
|
@ -137,6 +145,6 @@ class TaskResult:
|
|||
del result._result[remove_key]
|
||||
|
||||
# remove almost ALL internal keys, keep ones relevant to callback
|
||||
strip_internal_keys(result._result, exceptions=('_ansible_verbose_always', '_ansible_item_label', '_ansible_no_log'))
|
||||
strip_internal_keys(result._result, exceptions=CLEAN_EXCEPTIONS)
|
||||
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue