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

@@ -98,6 +98,10 @@ class CallbackBase(AnsiblePlugin):
# load from config
self._plugin_options = C.config.get_plugin_options(get_plugin_class(self), self._load_name, keys=task_keys, variables=var_options, direct=direct)
def _run_is_verbose(self, result, verbosity=0):
return ((self._display.verbosity > verbosity or result._result.get('_ansible_verbose_always', False) is True)
and result._result.get('_ansible_verbose_override', False) is False)
def _dump_results(self, result, indent=None, sort_keys=True, keep_invocation=False):
if not indent and (result.get('_ansible_verbose_always') or self._display.verbosity > 2):