From 9977eb4016f891302daecfce17a917ce1479432a Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Wed, 26 Jun 2024 01:11:59 +0100 Subject: [PATCH 1/2] sap_install_media_detect: append loop labels --- .../tasks/prepare/create_file_list_phase_1.yml | 2 ++ .../tasks/prepare/create_file_list_phase_2.yml | 4 ++++ .../tasks/prepare/move_files_to_main_directory.yml | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml index 56f0835f7..a6dc3b570 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml @@ -25,6 +25,8 @@ ansible.builtin.set_fact: __sap_install_media_detect_fact_find_result_phase_1: "{{ __sap_install_media_detect_fact_find_result_phase_1 + [item.path] }}" loop: "{{ __sap_install_media_detect_register_find_result_phase_1.files }}" + loop_control: + label: "{{ item.path }}" # If more than one SAPCAR file is found, we will use the last one. - name: SAP Install Media Detect - Prepare - Identify sapcar diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 355836b98..3219e613c 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -21,6 +21,8 @@ ansible.builtin.set_fact: __sap_install_media_detect_fact_find_result_phase_2: "{{ __sap_install_media_detect_fact_find_result_phase_2 + [item.path] }}" loop: "{{ __sap_install_media_detect_register_find_result_phase_2.files }}" + loop_control: + label: "{{ item.path }}" - name: SAP Install Media Detect - Prepare - Iterate over files and determine file type ansible.builtin.command: "{{ __sap_install_media_detect_sapfile_path }} -e --lsar_file={{ __sap_install_media_detect_rar_list.split(' ')[0] }} --sapcar_file={{ __sap_install_media_detect_fact_sapcar_path }} {{ line_item }}" @@ -34,6 +36,8 @@ ansible.builtin.set_fact: __sap_install_media_detect_fact_files_sapfile_results: "{{ __sap_install_media_detect_fact_files_sapfile_results + [__new_dict] }}" loop: "{{ __sap_install_media_detect_register_files_phase_2.results }}" + loop_control: + label: "{{ item.stdout.split(';')[0] }}" vars: __new_dict: dir: "{{ item.stdout.split(';')[0] | dirname }}" diff --git a/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml b/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml index 5bfae97f1..667370aa0 100644 --- a/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml +++ b/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml @@ -46,9 +46,9 @@ - name: SAP Install Media Detect - Prepare - Set fact from find result, phase 1b ansible.builtin.set_fact: __sap_install_media_detect_fact_find_result_phase_1b: "{{ __sap_install_media_detect_fact_find_result_phase_1b + [item.1.path] }}" - with_subelements: - - "{{ __sap_install_media_detect_register_find_result_phase_1b.results }}" - - files + loop: "{{ __sap_install_media_detect_register_find_result_phase_1b.results | subelements('files') }}" + loop_control: + label: "{{ item.path }}" # Reason for noqa: Too much additional code required for determining if anything has changed or not - name: SAP Install Media Detect - Prepare - Move files back to '{{ __sap_install_media_detect_software_main_directory }}' # noqa no-changed-when From 7572e1213d851ca32bb6438cc06e43c8fb42a1e7 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Wed, 26 Jun 2024 01:35:16 +0100 Subject: [PATCH 2/2] sap_install_media_detect: fix label list reference --- .../tasks/prepare/move_files_to_main_directory.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml b/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml index 667370aa0..2290863ef 100644 --- a/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml +++ b/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml @@ -48,7 +48,7 @@ __sap_install_media_detect_fact_find_result_phase_1b: "{{ __sap_install_media_detect_fact_find_result_phase_1b + [item.1.path] }}" loop: "{{ __sap_install_media_detect_register_find_result_phase_1b.results | subelements('files') }}" loop_control: - label: "{{ item.path }}" + label: "{{ item.1.path }}" # Reason for noqa: Too much additional code required for determining if anything has changed or not - name: SAP Install Media Detect - Prepare - Move files back to '{{ __sap_install_media_detect_software_main_directory }}' # noqa no-changed-when