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:
Kerwin Bryant 2019-06-07 03:37:28 +08:00 committed by ansibot
parent b9b0b23015
commit 95882faca6
4 changed files with 12 additions and 11 deletions

View file

@ -48,9 +48,6 @@ class CallbackModule(CallbackBase):
CALLBACK_TYPE = 'stdout'
CALLBACK_NAME = 'unixy'
def _run_is_verbose(self, result):
return ((self._display.verbosity > 0 or '_ansible_verbose_always' in result._result) and '_ansible_verbose_override' not in result._result)
def _get_task_display_name(self, task):
self.task_display_name = None
display_name = task.get_name().strip().split(" : ")
@ -216,6 +213,6 @@ class CallbackModule(CallbackBase):
def v2_runner_retry(self, result):
msg = " Retrying... (%d of %d)" % (result._result['attempts'], result._result['retries'])
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)