From 12fc1f62f314fa82309d4d4e60f494ce0fcbeb00 Mon Sep 17 00:00:00 2001 From: Jiri Podivin Date: Wed, 16 Jun 2021 16:45:55 +0200 Subject: [PATCH] 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 Change-Id: Id5990bba88f37636f3884553968dcbeb5c4ea88a --- roles/validations/tasks/run.yaml | 7 ++++--- roles/validations/tasks/validations.yaml | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/roles/validations/tasks/run.yaml b/roles/validations/tasks/run.yaml index e0c8b57..cc9c8f0 100644 --- a/roles/validations/tasks/run.yaml +++ b/roles/validations/tasks/run.yaml @@ -30,7 +30,8 @@ jsonres: 'results[*].Status' - fail: - msg: "Validation failed: some of the validations has failed." - when: - - item != "PASSED" + msg: "Validation failed with {{ validation_status }}: some of the validations has failed. {{ status }}" + when: validation_status != "PASSED" loop: "{{ status }}" + loop_control: + loop_var: validation_status diff --git a/roles/validations/tasks/validations.yaml b/roles/validations/tasks/validations.yaml index a0e64c3..c4a54be 100644 --- a/roles/validations/tasks/validations.yaml +++ b/roles/validations/tasks/validations.yaml @@ -26,8 +26,9 @@ jsonres: 'results[*].Status' - fail: - msg: "Validation failed: some of the validations has failed." - when: - - item != "PASSED" + msg: "Validation failed with {{ validation_status }}: some of the validations has failed. {{ status }}" + when: validation_status != "PASSED" loop: "{{ status }}" + loop_control: + loop_var: validation_status when: v_action == "run"