From 5eee6209993f2bd26ff239a87065014e0f67720d Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 27 Sep 2023 16:04:43 +0200 Subject: [PATCH 1/2] sap_install_media_detect: Detect MP XML files and move them into 'sap_swpm_download_basket' --- roles/sap_install_media_detect/files/tmp/sapfile | 16 +++++++++++++--- .../tasks/organize_files.yml | 3 ++- .../tasks/prepare/create_file_list_phase_2.yml | 4 +++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 860e1bf8f..6a37c1f7d 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -197,6 +197,7 @@ for _FILE in "$@"; do /RAR archive data/{_file_type="rar"} /Zip archive data/{_file_type="zip"} /SAPCAR archive data/{_file_type="sapcar"} + /XML/&&/ASCII/{_file_type="xml"} /directory/{_file_type="dir"} END{print _file_type}') if [[ ${_GENERIC_FILE_TYPE}. == "rarexe." ]]; then @@ -207,6 +208,8 @@ for _FILE in "$@"; do _list_content="zipinfo -1" elif [[ ${_GENERIC_FILE_TYPE}. == "sapcar." ]]; then _list_content="${_SAPCAR_FILE} -tvf" + elif [[ ${_GENERIC_FILE_TYPE}. == "xml." ]]; then + _list_content="cat" elif [[ ${_GENERIC_FILE_TYPE}. == "dir." ]]; then _list_content="" fi @@ -240,7 +243,7 @@ for _FILE in "$@"; do /S4/&&/LANG/{_sap_file_type="sap_s4hana_lang"} /S4/&&/EXPORT/{_sap_file_type="sap_export_s4hana"} /BW4/&&/EXPORT/{_sap_file_type="sap_export_bw4hana"} - /VCH/&&/\.SAR/{_sap_file_type="sap_vch_afl"} + /VCH/&&/\.SAR/{_sap_file_type="saphana_vch_afl"} END{print _sap_file_type}') if [[ ${SAP_FILE_TYPE_FROM_FILENAME}. == "sap_kernel_db." ]]; then SAP_FILE_TYPE_FROM_FILENAME=$(eval "${_list_content}" "${_FILE}" | awk ' @@ -256,7 +259,8 @@ for _FILE in "$@"; do elif [[ ${_GENERIC_FILE_TYPE}. == "rarexe." || ${_GENERIC_FILE_TYPE}. == "rar." || ${_GENERIC_FILE_TYPE}. == "zip." || - ${_GENERIC_FILE_TYPE}. == "sapcar." ]]; then + ${_GENERIC_FILE_TYPE}. == "sapcar." || + ${_GENERIC_FILE_TYPE}. == "xml." ]]; then _SAP_FILE_TYPE=$(eval "${_list_content}" "${_FILE}" | awk ' BEGIN{_sap_file_type="sap_unknown"} /BD_SYBASE_ASE/{_sap_file_type="sapase"} @@ -273,6 +277,7 @@ for _FILE in "$@"; do /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_export_nwas_abap"} /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_export_nwas_java"} /DATA_UNITS\/SOLMAN/&&/_JAVA_UT/{_sap_file_type="sap_export_solman_java"} + / Date: Wed, 27 Sep 2023 16:36:01 +0200 Subject: [PATCH 2/2] sap_install_media_detect: Also identify the MP XML files and set the related variables --- roles/sap_install_media_detect/defaults/main.yml | 1 + .../tasks/find_files_after_extraction.yml | 8 ++++++++ roles/sap_install_media_detect/tasks/set_global_vars.yml | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 961ffd693..a1a1fe264 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -74,6 +74,7 @@ sap_install_media_detect_kernel: false sap_install_media_detect_kernel_db: '' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 # (only necessary if there is more than one SAPEXEDB file in the source directory) sap_install_media_detect_webdisp: false +sap_install_media_detect_mpstack: false sap_install_media_detect_export: '' # saps4hana, sapbw4hana, sapecc, sapecc_ides, # sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 523c575c1..fcf0ccbd7 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -269,6 +269,14 @@ - sap_install_media_detect_webdisp - sap_swpm_web_dispatcher_file_name_get.stdout_lines | count > 1 +- name: SAP Install Media Detect - Find files after extraction - Find Maintenance Planner Stack XML file + ansible.builtin.shell: set -o pipefail && ls -1tr *.xml | tail -1 + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_mp_xml_file_name_get + changed_when: false + when: sap_install_media_detect_mpstack + - name: SAP Install Media Detect - Find files after extraction - Find SAP ECC Export ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_ecc_extracted" diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 32e07d394..659090141 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -148,6 +148,13 @@ sap_swpm_igs_helper_file_name: "{{ sap_swpm_igs_helper_file_name_get.stdout }}" when: sap_install_media_detect_igs +- name: SAP Install Media Detect - Detection completed - Set facts for SAP Maintenance Planner Stack XML files + ansible.builtin.set_fact: + sap_swpm_mp_stack_path: "{{ sap_swpm_software_path }}/" + sap_swpm_mp_stack_file_name: "{{ sap_swpm_mp_xml_file_name_get.stdout }}" + ignore_errors: true + when: sap_install_media_detect_mpstack + - name: SAP Install Media Detect - Detection completed - Set facts for WebDisp ansible.builtin.set_fact: sap_swpm_web_dispatcher_path: "{{ sap_swpm_software_path }}/" @@ -241,6 +248,8 @@ - sap_swpm_kernel_independent_file_name - sap_swpm_web_dispatcher_path - sap_swpm_web_dispatcher_file_name + - sap_swpm_mp_stack_path + - sap_swpm_mp_stack_file_name - name: SAP Install Media Detect - Detection completed - Display result ansible.builtin.debug: