Loop variable name conflict resolution

This change resolves name collision and prevents possible
issues with the loop behavior, as noted by the warning:

	The loop variable 'item' is already in use. You should set the
	`loop_var` value in the `loop_control` option for the task to something else to
	avoid variable collisions and unexpected behavior.

https://zuul.opendev.org/t/openstack/build/ed45cae1f67343ed875b6f7126ca80c9/log/job-output.txt#3713-3717

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Id5990bba88f37636f3884553968dcbeb5c4ea88a
This commit is contained in:
Jiri Podivin 2021-06-16 16:45:55 +02:00
parent 35f34ffdab
commit 12fc1f62f3
2 changed files with 8 additions and 6 deletions

View File

@ -30,7 +30,8 @@
jsonres: 'results[*].Status' jsonres: 'results[*].Status'
- fail: - fail:
msg: "Validation failed: some of the validations has failed." msg: "Validation failed with {{ validation_status }}: some of the validations has failed. {{ status }}"
when: when: validation_status != "PASSED"
- item != "PASSED"
loop: "{{ status }}" loop: "{{ status }}"
loop_control:
loop_var: validation_status

View File

@ -26,8 +26,9 @@
jsonres: 'results[*].Status' jsonres: 'results[*].Status'
- fail: - fail:
msg: "Validation failed: some of the validations has failed." msg: "Validation failed with {{ validation_status }}: some of the validations has failed. {{ status }}"
when: when: validation_status != "PASSED"
- item != "PASSED"
loop: "{{ status }}" loop: "{{ status }}"
loop_control:
loop_var: validation_status
when: v_action == "run" when: v_action == "run"