Don't output complex items in the summary line

When iterating over complex objects, printing them out in the task
summary line is very noisy and hard to follow.

Change-Id: I4ae748f167ee03ba97a4bcbf2417dae0271e24a5
This commit is contained in:
Monty Taylor 2017-08-31 13:48:59 -05:00
parent c9f5675749
commit a36b3b314c
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
2 changed files with 17 additions and 4 deletions

View File

@ -20,6 +20,13 @@
- item2
- item3
- name: Loop with complex items
command: "echo {{ item.name }}"
with_items:
- name: complex1
- name: complex2
- name: complex3
- name: Run a shell task with an ansible python exception
command: echo foo
args:

View File

@ -428,10 +428,16 @@ class CallbackModule(default.CallbackModule):
indent=2, sort_keys=True),
status=status)
else:
self._log_message(
result,
"Item: {item} Runtime: {delta}"
" Start: {start} End: {end}".format(**result_dict))
if isinstance(result_dict['item'], str):
self._log_message(
result,
"Item: {item} Runtime: {delta}"
" Start: {start} End: {end}".format(**result_dict))
else:
self._log_message(
result,
"Item: Runtime: {delta} Start: {start} End: {end}".format(
**result_dict))
if self._deferred_result:
self._process_deferred(result)