Loop over incomplete subunit files properly

We are still trying to get incomplete subunit files into our logs. This
is now failing because we assumed a single dict with a files entry to
iterate over but in reality we get a list of dicts with files entries to
iterate over. In order to iterate over this content we use
with_subelements to iterate over and copy the found files.

Change-Id: I160ac5caeec6fd7f5a35e805b7d4811b20405d14
This commit is contained in:
Clark Boylan 2020-08-07 11:05:41 -07:00
parent 155a880534
commit 4ab37d798a

View File

@ -31,15 +31,20 @@
loop_control:
loop_var: zj_item
# This loop is a bit convoluted because what we get from the previous
# task is a list of dicts containing a list of files. We use
# with_subelements to iterate over the list of dicts and their internal
# files lists.
- name: Copy any inflight subunit files
copy:
dest: "{{ zuul_output_dir }}/logs/"
src: "{{ zj_item.path }}"
src: "{{ zj_item.1.path }}"
remote_src: true
with_items: "{{ partial_subunit_files.files }}"
with_subelements:
- "{{ partial_subunit_files.results }}"
- files
loop_control:
loop_var: zj_item
when: partial_subunit_files.files is defined
- when:
- testr_command.rc == 0