better cleanup on task results display (#27175)

* better cleanup on task results display

callbacks get 'clean' copy of result objects
moved cleanup into result object itself
removed now redundant callback cleanup
moved no_log tests

* moved import as per feedback
This commit is contained in:
Brian Coca 2017-10-16 09:44:11 -04:00 committed by GitHub
commit 01b6c7c9c6
6 changed files with 64 additions and 19 deletions

View file

@ -85,8 +85,6 @@ class CallbackBase(AnsiblePlugin):
self._plugin_options = options
def _dump_results(self, result, indent=None, sort_keys=True, keep_invocation=False):
if result.get('_ansible_no_log', False):
return json.dumps(dict(censored="the output has been hidden due to the fact that 'no_log: true' was specified for this result"))
if not indent and (result.get('_ansible_verbose_always') or self._display.verbosity > 2):
indent = 4
@ -219,10 +217,8 @@ class CallbackBase(AnsiblePlugin):
del result._result['results']
def _clean_results(self, result, task_name):
if task_name in ['debug']:
for remove_key in ('changed', 'invocation', 'failed', 'skipped'):
if remove_key in result:
del result[remove_key]
''' removes data from results for display '''
pass
def set_play_context(self, play_context):
pass