mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-19 03:10:22 -07:00
Optimize the code for the callback module (#56827)
* Optimize the code for the callback module * fix pep error * Restore incorrectly submitted code * fix pep error * fix pep error * Restore incorrectly submitted code * Restore incorrectly submitted code * fix condition * fix condition * fix pep error
This commit is contained in:
parent
b9b0b23015
commit
95882faca6
4 changed files with 12 additions and 11 deletions
|
@ -131,7 +131,7 @@ class CallbackModule(CallbackBase):
|
|||
else:
|
||||
self._clean_results(result._result, result._task.action)
|
||||
|
||||
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
|
||||
if self._run_is_verbose(result):
|
||||
msg += " => %s" % (self._dump_results(result._result),)
|
||||
self._display.display(msg, color=color)
|
||||
|
||||
|
@ -148,7 +148,7 @@ class CallbackModule(CallbackBase):
|
|||
self._process_items(result)
|
||||
else:
|
||||
msg = "skipping: [%s]" % result._host.get_name()
|
||||
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
|
||||
if self._run_is_verbose(result):
|
||||
msg += " => %s" % self._dump_results(result._result)
|
||||
self._display.display(msg, color=C.COLOR_SKIP)
|
||||
|
||||
|
@ -287,7 +287,7 @@ class CallbackModule(CallbackBase):
|
|||
|
||||
msg += " => (item=%s)" % (self._get_item_label(result._result),)
|
||||
|
||||
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
|
||||
if self._run_is_verbose(result):
|
||||
msg += " => %s" % self._dump_results(result._result)
|
||||
self._display.display(msg, color=color)
|
||||
|
||||
|
@ -315,7 +315,7 @@ class CallbackModule(CallbackBase):
|
|||
|
||||
self._clean_results(result._result, result._task.action)
|
||||
msg = "skipping: [%s] => (item=%s) " % (result._host.get_name(), self._get_item_label(result._result))
|
||||
if (self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
|
||||
if self._run_is_verbose(result):
|
||||
msg += " => %s" % self._dump_results(result._result)
|
||||
self._display.display(msg, color=C.COLOR_SKIP)
|
||||
|
||||
|
@ -397,7 +397,7 @@ class CallbackModule(CallbackBase):
|
|||
def v2_runner_retry(self, result):
|
||||
task_name = result.task_name or result._task
|
||||
msg = "FAILED - RETRYING: %s (%d retries left)." % (task_name, result._result['retries'] - result._result['attempts'])
|
||||
if (self._display.verbosity > 2 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result:
|
||||
if self._run_is_verbose(result, verbosity=2):
|
||||
msg += "Result was: %s" % self._dump_results(result._result)
|
||||
self._display.display(msg, color=C.COLOR_DEBUG)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue