Merge "Don't output complex items in the summary line" into feature/zuulv3
diff --git a/playbooks/zuul-stream/fixtures/test-stream.yaml b/playbooks/zuul-stream/fixtures/test-stream.yaml
index 5bffc16..29bbf47 100644
--- a/playbooks/zuul-stream/fixtures/test-stream.yaml
+++ b/playbooks/zuul-stream/fixtures/test-stream.yaml
@@ -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:
diff --git a/zuul/ansible/callback/zuul_stream.py b/zuul/ansible/callback/zuul_stream.py
index 9a7a925..906f052 100644
--- a/zuul/ansible/callback/zuul_stream.py
+++ b/zuul/ansible/callback/zuul_stream.py
@@ -428,10 +428,16 @@
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)