1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

fixed indent issues

This commit is contained in:
Brian Coca 2015-07-28 10:10:21 -04:00
parent 77fc3ce759
commit 787a0c4e04
2 changed files with 6 additions and 3 deletions

View file

@ -50,11 +50,14 @@ class CallbackBase:
version = getattr(self, 'CALLBACK_VERSION', '1.0') version = getattr(self, 'CALLBACK_VERSION', '1.0')
self._display.vvvv('Loaded callback %s of type %s, v%s' % (name, ctype, version)) self._display.vvvv('Loaded callback %s of type %s, v%s' % (name, ctype, version))
def _dump_results(self, result, indent=4, sort_keys=True): def _dump_results(self, result, indent=None, sort_keys=True):
if result.get('_ansible_no_log', False): if result.get('_ansible_no_log', False):
return json.dumps(dict(censored="the output has been hidden due to the fact that 'no_log: true' was specified for this result")) return json.dumps(dict(censored="the output has been hidden due to the fact that 'no_log: true' was specified for this result"))
if not indent and '_ansible_verbose_always' in result and result['_ansible_verbose_always']:
indent = 4
# All result keys stating with _ansible_ are internal, so remove them from the result before we output anything. # All result keys stating with _ansible_ are internal, so remove them from the result before we output anything.
for k in result.keys(): for k in result.keys():
if isinstance(k, string_types) and k.startswith('_ansible_'): if isinstance(k, string_types) and k.startswith('_ansible_'):

View file

@ -61,13 +61,13 @@ class CallbackModule(CallbackBase):
if result._task.action in C.MODULE_NO_JSON: 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: else:
self._display.display("%s | FAILED! => %s" % (result._host.get_name(), self._dump_results(result._result)), 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): def v2_runner_on_ok(self, result):
if result._task.action in C.MODULE_NO_JSON: 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: else:
self._display.display("%s | SUCCESS => %s" % (result._host.get_name(), self._dump_results(result._result)), 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) self._handle_warnings(result._result)
def v2_runner_on_skipped(self, result): def v2_runner_on_skipped(self, result):