mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
added no_log censoring to item output
should be last commit that fixes #12214
This commit is contained in:
parent
5c39538a73
commit
4c9f58a152
2 changed files with 16 additions and 6 deletions
|
@ -107,10 +107,19 @@ class CallbackBase:
|
|||
except UnicodeDecodeError:
|
||||
ret.append(">> the files are different, but the diff library cannot compare unicode strings\n\n")
|
||||
|
||||
def _get_item(self, result):
|
||||
if '_ansible_no_log' in result:
|
||||
item = "(censored due to no_log)"
|
||||
else:
|
||||
item = getattr(result, 'item', "(censored due to no_log)")
|
||||
|
||||
return item
|
||||
|
||||
def _process_items(self, result):
|
||||
|
||||
for res in result._result['results']:
|
||||
newres = deepcopy(result)
|
||||
res['item'] = self._get_item(res)
|
||||
newres._result = res
|
||||
if 'failed' in res and res['failed']:
|
||||
self.v2_playbook_item_on_failed(newres)
|
||||
|
@ -119,7 +128,7 @@ class CallbackBase:
|
|||
else:
|
||||
self.v2_playbook_item_on_ok(newres)
|
||||
|
||||
#del result._result['results']
|
||||
del result._result['results']
|
||||
|
||||
def set_play_context(self, play_context):
|
||||
pass
|
||||
|
@ -202,9 +211,7 @@ class CallbackBase:
|
|||
def v2_runner_on_skipped(self, result):
|
||||
if C.DISPLAY_SKIPPED_HOSTS:
|
||||
host = result._host.get_name()
|
||||
#FIXME, get item to pass through
|
||||
item = None
|
||||
self.runner_on_skipped(host, item)
|
||||
self.runner_on_skipped(host, self._get_item(getattr(result._result,'results',{})))
|
||||
|
||||
def v2_runner_on_unreachable(self, result):
|
||||
host = result._host.get_name()
|
||||
|
|
|
@ -89,6 +89,9 @@ class CallbackModule(CallbackBase):
|
|||
def v2_runner_on_skipped(self, result):
|
||||
if C.DISPLAY_SKIPPED_HOSTS:
|
||||
msg = "skipping: [%s]" % result._host.get_name()
|
||||
if result._task.loop and 'results' in result._result:
|
||||
self._process_items(result)
|
||||
else:
|
||||
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and not '_ansible_verbose_override' in result._result:
|
||||
msg += " => %s" % self._dump_results(result._result)
|
||||
self._display.display(msg, color='cyan')
|
||||
|
|
Loading…
Reference in a new issue