diff options
author | Brian Coca <brian.coca+git@gmail.com> | 2015-10-23 14:05:57 -0400 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2015-10-23 14:06:20 -0400 |
commit | 275764d4a5bd5ff9a10f581507f6275fb55caf3f (patch) | |
tree | 1ab0295d1ddc86e22929545ca4a2eb4ba8bd4c21 | |
parent | 63ea614b4c5222d292d97f5827fb1b161f681daa (diff) | |
download | ansible-275764d4a5bd5ff9a10f581507f6275fb55caf3f.tar.gz |
avoid showing invokation when no_log is set or verbosity is low
-rw-r--r-- | lib/ansible/plugins/callback/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/ansible/plugins/callback/__init__.py b/lib/ansible/plugins/callback/__init__.py index bc70a195a2..183895e5fd 100644 --- a/lib/ansible/plugins/callback/__init__.py +++ b/lib/ansible/plugins/callback/__init__.py @@ -50,7 +50,8 @@ class CallbackBase: def _dump_results(self, result, indent=None, sort_keys=True): - if result.get('_ansible_no_log', False): + no_log = result.get('_ansible_no_log', False): + if no_log: 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 '_ansible_verbose_always' in result and result['_ansible_verbose_always']: @@ -61,6 +62,10 @@ class CallbackBase: if isinstance(k, string_types) and k.startswith('_ansible_'): del result[k] + # remove invocation info unless its very very verbose + if 'invocation' in result and (self._display.verbosity < 3 or no_log): + del result['invocation'] + return json.dumps(result, indent=indent, ensure_ascii=False, sort_keys=sort_keys) def _handle_warnings(self, res): |