mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Implement invocation hiding for all callbacks if the verbosity is low
This commit is contained in:
parent
275764d4a5
commit
3812ec8d1d
2 changed files with 22 additions and 20 deletions
|
@ -34,7 +34,7 @@ class CallbackModule(CallbackBase):
|
|||
CALLBACK_TYPE = 'stdout'
|
||||
CALLBACK_NAME = 'minimal'
|
||||
|
||||
def _command_generic_msg(self, host, result, caption):
|
||||
def _command_generic_msg(self, host, result, caption):
|
||||
''' output the result of a command run '''
|
||||
|
||||
buf = "%s | %s | rc=%s >>\n" % (host, caption, result.get('rc',0))
|
||||
|
@ -59,28 +59,22 @@ class CallbackModule(CallbackBase):
|
|||
del result._result['exception']
|
||||
|
||||
if result._task.action in C.MODULE_NO_JSON:
|
||||
self._display.display(self._command_generic_msg(result._host.get_name(), result._result,"FAILED"), color='red')
|
||||
self._display.display(self._command_generic_msg(result._host.get_name(), result._result, "FAILED"), color='red')
|
||||
else:
|
||||
abridged_result = result._result.copy()
|
||||
abridged_result.pop('invocation', None)
|
||||
self._display.display("%s | FAILED! => %s" % (result._host.get_name(), self._dump_results(abridged_result, indent=4)), color='red')
|
||||
self._display.display("%s | FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result, indent=4)), color='red')
|
||||
|
||||
def v2_runner_on_ok(self, result):
|
||||
if result._task.action in C.MODULE_NO_JSON:
|
||||
self._display.display(self._command_generic_msg(result._host.get_name(), result._result,"SUCCESS"), color='green')
|
||||
self._display.display(self._command_generic_msg(result._host.get_name(), result._result, "SUCCESS"), color='green')
|
||||
else:
|
||||
abridged_result = result._result.copy()
|
||||
abridged_result.pop('invocation', None)
|
||||
self._display.display("%s | SUCCESS => %s" % (result._host.get_name(), self._dump_results(abridged_result, indent=4)), color='green')
|
||||
self._display.display("%s | SUCCESS => %s" % (result._host.get_name(), self._dump_results(result._result, indent=4)), color='green')
|
||||
self._handle_warnings(result._result)
|
||||
|
||||
def v2_runner_on_skipped(self, result):
|
||||
self._display.display("%s | SKIPPED" % (result._host.get_name()), color='cyan')
|
||||
|
||||
def v2_runner_on_unreachable(self, result):
|
||||
abridged_result = result._result.copy()
|
||||
abridged_result.pop('invocation', None)
|
||||
self._display.display("%s | UNREACHABLE! => %s" % (result._host.get_name(), self._dump_results(abridged_result, indent=4)), color='yellow')
|
||||
self._display.display("%s | UNREACHABLE! => %s" % (result._host.get_name(), self._dump_results(result._result, indent=4)), color='yellow')
|
||||
|
||||
def v2_on_file_diff(self, result):
|
||||
if 'diff' in result._result and result._result['diff']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue