Don't use item in collect container logs loop
The default loop variable 'item' cannot be nested. Because roles like collect-container-logs may be called from higher level loops that use 'item' we override the loop control var to a name that should be unique. This should probably be done to all of the other roles in zuul-jobs too. Change-Id: I2f647596dd40c662aa7447e3d3c8844a77c6b109
This commit is contained in:
parent
a7c7d4fa16
commit
e323dc117b
@ -10,7 +10,11 @@
|
|||||||
|
|
||||||
- name: Save container logs
|
- name: Save container logs
|
||||||
loop: "{{ docker_containers.stdout_lines | default([]) }}"
|
loop: "{{ docker_containers.stdout_lines | default([]) }}"
|
||||||
shell: "{{ container_command }} logs {{ item }} &> {{ ansible_user_dir }}/zuul-output/logs/{{ container_command }}/{{ item }}.txt"
|
# We can't use the default 'item' because roles may be used in
|
||||||
|
# higher level loops and 'item' could conflict in that case.
|
||||||
|
loop_control:
|
||||||
|
loop_var: loop_container_name
|
||||||
|
shell: "{{ container_command }} logs {{ loop_container_name }} &> {{ ansible_user_dir }}/zuul-output/logs/{{ container_command }}/{{ loop_container_name }}.txt"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
Loading…
Reference in New Issue
Block a user