diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2017-12-12 13:01:52 -0500 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2017-12-12 13:05:38 -0500 |
commit | 5067a1340a514b5359961c53f6c2943d20e8b363 (patch) | |
tree | ff63e2af333d90696479c81a1db30c3149cb7723 | |
parent | 5fb97aa6c956068e2e732950a0dc0f126a58e0ec (diff) | |
download | ansible-5067a1340a514b5359961c53f6c2943d20e8b363.tar.gz |
always preserve certain keys (#33637)
* always preserve certain keys
fixes #33433
* results
(cherry picked from commit 8d78a829c60cc63e668683fb5d626eba942e6a39)
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | lib/ansible/executor/task_result.py | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index eb1a206a31..1c79e26c14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Ansible Changes By Release https://github.com/ansible/ansible/issues/32685 * Fix fetch on Windows failing to fetch files or particular block size (https://github.com/ansible/ansible/pull/33697) +* preserve certain fields during no log. https://github.com/ansible/ansible/pull/33637 <a id="2.4.2"></a> diff --git a/lib/ansible/executor/task_result.py b/lib/ansible/executor/task_result.py index 232a45d94f..3c94e44c34 100644 --- a/lib/ansible/executor/task_result.py +++ b/lib/ansible/executor/task_result.py @@ -25,6 +25,7 @@ from ansible.parsing.dataloader import DataLoader from ansible.vars.manager import strip_internal_keys _IGNORE = ('failed', 'skipped') +_PRESERVE = ('attempts', 'changed', 'retries') class TaskResult: @@ -104,7 +105,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) |