mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
always preserve certain keys (#33637)
* always preserve certain keys fixes #33433 * results
This commit is contained in:
parent
7bc7c347dd
commit
8d78a829c6
1 changed files with 6 additions and 1 deletions
|
@ -11,6 +11,7 @@ from ansible.parsing.dataloader import DataLoader
|
|||
from ansible.vars.clean import strip_internal_keys
|
||||
|
||||
_IGNORE = ('failed', 'skipped')
|
||||
_PRESERVE = ('attempts', 'changed', 'retries')
|
||||
|
||||
|
||||
class TaskResult:
|
||||
|
@ -90,7 +91,11 @@ class TaskResult:
|
|||
ignore = _IGNORE
|
||||
|
||||
if self._result.get('_ansible_no_log', False):
|
||||
result._result = {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result"}
|
||||
x = {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result"}
|
||||
for preserve in _PRESERVE:
|
||||
if preserve in self._result:
|
||||
x[preserve] = self._result[preserve]
|
||||
result._result = x
|
||||
elif self._result:
|
||||
result._result = deepcopy(self._result)
|
||||
|
||||
|
|
Loading…
Reference in a new issue