From 4065acc37de1408b3ced2814b1c5917903a41d9e Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Sat, 23 Jul 2016 17:10:53 -0500 Subject: [PATCH] indent callback output if using 3verbosity or higher (#16231) --- lib/ansible/plugins/callback/__init__.py | 2 +- test/integration/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/callback/__init__.py b/lib/ansible/plugins/callback/__init__.py index 3c41e59c4a..c2064ef57e 100644 --- a/lib/ansible/plugins/callback/__init__.py +++ b/lib/ansible/plugins/callback/__init__.py @@ -89,7 +89,7 @@ class CallbackBase: 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")) - if not indent and '_ansible_verbose_always' in result and result['_ansible_verbose_always']: + if not indent and (result.get('_ansible_verbose_always') or self._display.verbosity > 2): indent = 4 # All result keys stating with _ansible_ are internal, so remove them from the result before we output anything. diff --git a/test/integration/Makefile b/test/integration/Makefile index 2d4c9f5ba7..8a73698ec3 100644 --- a/test/integration/Makefile +++ b/test/integration/Makefile @@ -295,7 +295,7 @@ test_lookup_paths: setup no_log: setup # This test expects 7 loggable vars and 0 non loggable ones, if either mismatches it fails, run the ansible-playbook command to debug - [ "$$(ansible-playbook no_log_local.yml -i $(INVENTORY) -e outputdir=$(TEST_DIR) -vvvvv | awk --source 'BEGIN { logme = 0; nolog = 0; } /LOG_ME/ { logme += 1;} /DO_NOT_LOG/ { nolog += 1;} END { printf "%d/%d", logme, nolog; }')" = "6/0" ] + [ "$$(ansible-playbook no_log_local.yml -i $(INVENTORY) -e outputdir=$(TEST_DIR) -vvvvv | awk --source 'BEGIN { logme = 0; nolog = 0; } /LOG_ME/ { logme += 1;} /DO_NOT_LOG/ { nolog += 1;} END { printf "%d/%d", logme, nolog; }')" = "26/0" ] test_binary_modules: mytmpdir=$(MYTMPDIR); \