From 10330ebc90fdab5781594e05dc56259629df38ed Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 19 Dec 2024 15:47:01 +0100 Subject: [PATCH] sap_swpm: Fix ansible-test sanity line-endings errors Signed-off-by: Bernd Finger --- .../tasks/post_install/sum_push_to_finish.yml | 346 +++++++++--------- 1 file changed, 173 insertions(+), 173 deletions(-) diff --git a/roles/sap_swpm/tasks/post_install/sum_push_to_finish.yml b/roles/sap_swpm/tasks/post_install/sum_push_to_finish.yml index 4942fc1e..3240ef5f 100644 --- a/roles/sap_swpm/tasks/post_install/sum_push_to_finish.yml +++ b/roles/sap_swpm/tasks/post_install/sum_push_to_finish.yml @@ -1,173 +1,173 @@ -# SPDX-License-Identifier: Apache-2.0 ---- -# Will keep pushing SUM through the two key manual steps until it finishes -# This allows to fully automate the SWPM+SUM installation process -# Based on research by @sean-freeman - -# Check if the SUMup process is running, give it 5 minutes to start -- name: Check if SAPup_real process is running (wait for 5 minutes until it starts) - ansible.builtin.shell: pgrep -c -u "{{ sap_swpm_sid | lower }}adm" -f SAPup_real - register: _sapup_process - retries: 5 - delay: 60 - until: _sapup_process.rc == 0 and _sapup_process.stdout|int > 0 - failed_when: _sapup_process.rc != 0 - -# Check the SUM status via SUMOBSEVER.XML, wait for 60 minutes until we are in BIND_PATCH phase -- name: Checking the status of SUM - ansible.builtin.uri: - url: "https://localhost:1129/lmsl/sumobserver/{{ sap_swpm_sid | upper }}/analysis/SUMOBSERVER.XML" - method: GET - validate_certs: false - return_content: true - status_code: 200 - user: "{{ sap_swpm_sid | lower }}adm" - password: "{{ sap_swpm_sap_sidadm_password }}" - register: _sap_swpm_sum_push - until: _sap_swpm_sum_push.status == 200 and 'SUM4ABAP|CONFIGURE|PREP_EXTENSION|BIND_PATCH|PatchSelection' in _sap_swpm_sum_push.content - retries: 60 - delay: 60 - failed_when: _sap_swpm_sum_push.status != 200 or 'SUM4ABAP|CONFIGURE|PREP_EXTENSION|BIND_PATCH|PatchSelection' not in _sap_swpm_sum_push.content - -# Get the config XML from SUM, repeat 3 times in case SUM is still busy and doesn't respond promptly -- name: Get the config XML from SUM - ansible.builtin.uri: - url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" - method: GET - validate_certs: false - return_content: true - status_code: 200 - user: "{{ sap_swpm_sid | lower }}adm" - password: "{{ sap_swpm_sap_sidadm_password }}" - # headers: - # Cookie: "{{ _sap_swpm_sum_push.cookies_string }}" - register: _sap_swpm_sum_push_config - until: _sap_swpm_sum_push_config.status == 200 - retries: 3 - delay: 60 - failed_when: _sap_swpm_sum_push_config.status != 200 - -# Get the CSRF token from SUM by calling config -- name: Get the CSRF token from SUM - ansible.builtin.uri: - url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" - method: GET - validate_certs: false - return_content: false - status_code: 200 - user: "{{ sap_swpm_sid | lower }}adm" - password: "{{ sap_swpm_sap_sidadm_password }}" - headers: - Cookie: "{{ _sap_swpm_sum_push_config.cookies_string }}" - X-CSRF-Token: Fetch - # X-Requested-With: XMLHttpRequest - register: _sap_swpm_sum_push - failed_when: _sap_swpm_sum_push.status != 200 - -# Post the config XML back to SUM unchanged as we want to keep the default patch levels as per the XML file. This will move SUM to the next step. -- name: Move SUM to the next step - ansible.builtin.uri: - url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" - method: POST - validate_certs: false - return_content: true - status_code: 200 - user: "{{ sap_swpm_sid | lower }}adm" - password: "{{ sap_swpm_sap_sidadm_password }}" - headers: - Cookie: "{{ _sap_swpm_sum_push_config.cookies_string }}" - X-CSRF-Token: "{{ _sap_swpm_sum_push.x_csrf_token }}" - body_format: raw - body: "{{ _sap_swpm_sum_push_config.content }}" - register: _sap_swpm_sum_push - until: _sap_swpm_sum_push.status == 200 - failed_when: _sap_swpm_sum_push.status != 200 - -# At this point SUM should be running. This will take anything between 6-12 hours to complete. -# Patiently check every 10 minutes to see if SUM has completed all the steps and is now in the SPAUINFO step. -# Check the SUM status via SUMOBSEVER.XML -- name: Checking the status of SUM - ansible.builtin.uri: - url: "https://localhost:1129/lmsl/sumobserver/{{ sap_swpm_sid | upper }}/analysis/SUMOBSERVER.XML" - method: GET - validate_certs: false - return_content: true - status_code: 200 - user: "{{ sap_swpm_sid | lower }}adm" - password: "{{ sap_swpm_sap_sidadm_password }}" - register: _sap_swpm_sum_push - until: _sap_swpm_sum_push.status == 200 and 'SUM4ABAP|POST-EXECUTE|MAIN_POSTPROC|SPAUINFO|FinishSPAU' in _sap_swpm_sum_push.content - retries: 72 # 12 hours - delay: 600 # 10 minutes - failed_when: _sap_swpm_sum_push.status != 200 or 'SUM4ABAP|POST-EXECUTE|MAIN_POSTPROC|SPAUINFO|FinishSPAU' not in _sap_swpm_sum_push.content - -# Get the config XML from SUM, repeat 3 times in case SUM is still busy and doesn't respond promptly -# Need to get config XML even through we are not going to use it. This is to get the diagtime cookie. -- name: Get the config XML from SUM - ansible.builtin.uri: - url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" - method: GET - validate_certs: false - return_content: true - status_code: 200 - user: "{{ sap_swpm_sid | lower }}adm" - password: "{{ sap_swpm_sap_sidadm_password }}" - # headers: - # Cookie: "{{ _sap_swpm_sum_push.cookies_string }}" - register: _sap_swpm_sum_push_config - until: _sap_swpm_sum_push_config.status == 200 - retries: 3 - delay: 60 - failed_when: _sap_swpm_sum_push_config.status != 200 - -# Get the CSRF token from SUM by calling config -- name: Get the CSRF token from SUM - ansible.builtin.uri: - url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" - method: GET - validate_certs: false - return_content: false - status_code: 200 - user: "{{ sap_swpm_sid | lower }}adm" - password: "{{ sap_swpm_sap_sidadm_password }}" - headers: - Cookie: "{{ _sap_swpm_sum_push_config.cookies_string }}" - X-CSRF-Token: Fetch - # X-Requested-With: XMLHttpRequest - register: _sap_swpm_sum_push - failed_when: _sap_swpm_sum_push.status != 200 - -# Post confirmation to SUM that no SPAU is required. This will move SUM to the next step. -- name: Move SUM to the next step - ansible.builtin.uri: - url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" - method: POST - validate_certs: false - return_content: true - status_code: 200 - user: "{{ sap_swpm_sid | lower }}adm" - password: "{{ sap_swpm_sap_sidadm_password }}" - headers: - Cookie: "{{ _sap_swpm_sum_push_config.cookies_string }}" - X-CSRF-Token: "{{ _sap_swpm_sum_push.x_csrf_token }}" - body_format: raw - body: 'DialogueValueslp.parameter.type.SCALAR10yes' - register: _sap_swpm_sum_push - failed_when: _sap_swpm_sum_push.status != 200 - -# Finally wait for SUM to finish the final steps. This shouldn't take more than 1 hour. -# Check the SUM status via SUMOBSEVER.XML, wait for 60 minutes until the status is 'MAIN_POSTCLEAN|EXIT' -- name: Checking the status of SUM and making sure it has finished - ansible.builtin.uri: - url: "https://localhost:1129/lmsl/sumobserver/{{ sap_swpm_sid | upper }}/analysis/SUMOBSERVER.XML" - method: GET - validate_certs: false - return_content: true - status_code: 200 - user: "{{ sap_swpm_sid | lower }}adm" - password: "{{ sap_swpm_sap_sidadm_password }}" - register: _sap_swpm_sum_push - until: _sap_swpm_sum_push.status == 200 and 'SUM4ABAP|MAIN_POSTCLEAN|EXIT|UnitWizard' in _sap_swpm_sum_push.content - retries: 60 - delay: 60 - failed_when: _sap_swpm_sum_push.status != 200 or 'SUM4ABAP|MAIN_POSTCLEAN|EXIT|UnitWizard' not in _sap_swpm_sum_push.content +# SPDX-License-Identifier: Apache-2.0 +--- +# Will keep pushing SUM through the two key manual steps until it finishes +# This allows to fully automate the SWPM+SUM installation process +# Based on research by @sean-freeman + +# Check if the SUMup process is running, give it 5 minutes to start +- name: Check if SAPup_real process is running (wait for 5 minutes until it starts) + ansible.builtin.shell: pgrep -c -u "{{ sap_swpm_sid | lower }}adm" -f SAPup_real + register: _sapup_process + retries: 5 + delay: 60 + until: _sapup_process.rc == 0 and _sapup_process.stdout|int > 0 + failed_when: _sapup_process.rc != 0 + +# Check the SUM status via SUMOBSEVER.XML, wait for 60 minutes until we are in BIND_PATCH phase +- name: Checking the status of SUM + ansible.builtin.uri: + url: "https://localhost:1129/lmsl/sumobserver/{{ sap_swpm_sid | upper }}/analysis/SUMOBSERVER.XML" + method: GET + validate_certs: false + return_content: true + status_code: 200 + user: "{{ sap_swpm_sid | lower }}adm" + password: "{{ sap_swpm_sap_sidadm_password }}" + register: _sap_swpm_sum_push + until: _sap_swpm_sum_push.status == 200 and 'SUM4ABAP|CONFIGURE|PREP_EXTENSION|BIND_PATCH|PatchSelection' in _sap_swpm_sum_push.content + retries: 60 + delay: 60 + failed_when: _sap_swpm_sum_push.status != 200 or 'SUM4ABAP|CONFIGURE|PREP_EXTENSION|BIND_PATCH|PatchSelection' not in _sap_swpm_sum_push.content + +# Get the config XML from SUM, repeat 3 times in case SUM is still busy and doesn't respond promptly +- name: Get the config XML from SUM + ansible.builtin.uri: + url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" + method: GET + validate_certs: false + return_content: true + status_code: 200 + user: "{{ sap_swpm_sid | lower }}adm" + password: "{{ sap_swpm_sap_sidadm_password }}" + # headers: + # Cookie: "{{ _sap_swpm_sum_push.cookies_string }}" + register: _sap_swpm_sum_push_config + until: _sap_swpm_sum_push_config.status == 200 + retries: 3 + delay: 60 + failed_when: _sap_swpm_sum_push_config.status != 200 + +# Get the CSRF token from SUM by calling config +- name: Get the CSRF token from SUM + ansible.builtin.uri: + url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" + method: GET + validate_certs: false + return_content: false + status_code: 200 + user: "{{ sap_swpm_sid | lower }}adm" + password: "{{ sap_swpm_sap_sidadm_password }}" + headers: + Cookie: "{{ _sap_swpm_sum_push_config.cookies_string }}" + X-CSRF-Token: Fetch + # X-Requested-With: XMLHttpRequest + register: _sap_swpm_sum_push + failed_when: _sap_swpm_sum_push.status != 200 + +# Post the config XML back to SUM unchanged as we want to keep the default patch levels as per the XML file. This will move SUM to the next step. +- name: Move SUM to the next step + ansible.builtin.uri: + url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" + method: POST + validate_certs: false + return_content: true + status_code: 200 + user: "{{ sap_swpm_sid | lower }}adm" + password: "{{ sap_swpm_sap_sidadm_password }}" + headers: + Cookie: "{{ _sap_swpm_sum_push_config.cookies_string }}" + X-CSRF-Token: "{{ _sap_swpm_sum_push.x_csrf_token }}" + body_format: raw + body: "{{ _sap_swpm_sum_push_config.content }}" + register: _sap_swpm_sum_push + until: _sap_swpm_sum_push.status == 200 + failed_when: _sap_swpm_sum_push.status != 200 + +# At this point SUM should be running. This will take anything between 6-12 hours to complete. +# Patiently check every 10 minutes to see if SUM has completed all the steps and is now in the SPAUINFO step. +# Check the SUM status via SUMOBSEVER.XML +- name: Checking the status of SUM + ansible.builtin.uri: + url: "https://localhost:1129/lmsl/sumobserver/{{ sap_swpm_sid | upper }}/analysis/SUMOBSERVER.XML" + method: GET + validate_certs: false + return_content: true + status_code: 200 + user: "{{ sap_swpm_sid | lower }}adm" + password: "{{ sap_swpm_sap_sidadm_password }}" + register: _sap_swpm_sum_push + until: _sap_swpm_sum_push.status == 200 and 'SUM4ABAP|POST-EXECUTE|MAIN_POSTPROC|SPAUINFO|FinishSPAU' in _sap_swpm_sum_push.content + retries: 72 # 12 hours + delay: 600 # 10 minutes + failed_when: _sap_swpm_sum_push.status != 200 or 'SUM4ABAP|POST-EXECUTE|MAIN_POSTPROC|SPAUINFO|FinishSPAU' not in _sap_swpm_sum_push.content + +# Get the config XML from SUM, repeat 3 times in case SUM is still busy and doesn't respond promptly +# Need to get config XML even through we are not going to use it. This is to get the diagtime cookie. +- name: Get the config XML from SUM + ansible.builtin.uri: + url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" + method: GET + validate_certs: false + return_content: true + status_code: 200 + user: "{{ sap_swpm_sid | lower }}adm" + password: "{{ sap_swpm_sap_sidadm_password }}" + # headers: + # Cookie: "{{ _sap_swpm_sum_push.cookies_string }}" + register: _sap_swpm_sum_push_config + until: _sap_swpm_sum_push_config.status == 200 + retries: 3 + delay: 60 + failed_when: _sap_swpm_sum_push_config.status != 200 + +# Get the CSRF token from SUM by calling config +- name: Get the CSRF token from SUM + ansible.builtin.uri: + url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" + method: GET + validate_certs: false + return_content: false + status_code: 200 + user: "{{ sap_swpm_sid | lower }}adm" + password: "{{ sap_swpm_sap_sidadm_password }}" + headers: + Cookie: "{{ _sap_swpm_sum_push_config.cookies_string }}" + X-CSRF-Token: Fetch + # X-Requested-With: XMLHttpRequest + register: _sap_swpm_sum_push + failed_when: _sap_swpm_sum_push.status != 200 + +# Post confirmation to SUM that no SPAU is required. This will move SUM to the next step. +- name: Move SUM to the next step + ansible.builtin.uri: + url: "https://localhost:1129/slp/sumabap/{{ sap_swpm_sid | upper }}/config" + method: POST + validate_certs: false + return_content: true + status_code: 200 + user: "{{ sap_swpm_sid | lower }}adm" + password: "{{ sap_swpm_sap_sidadm_password }}" + headers: + Cookie: "{{ _sap_swpm_sum_push_config.cookies_string }}" + X-CSRF-Token: "{{ _sap_swpm_sum_push.x_csrf_token }}" + body_format: raw + body: 'DialogueValueslp.parameter.type.SCALAR10yes' + register: _sap_swpm_sum_push + failed_when: _sap_swpm_sum_push.status != 200 + +# Finally wait for SUM to finish the final steps. This shouldn't take more than 1 hour. +# Check the SUM status via SUMOBSEVER.XML, wait for 60 minutes until the status is 'MAIN_POSTCLEAN|EXIT' +- name: Checking the status of SUM and making sure it has finished + ansible.builtin.uri: + url: "https://localhost:1129/lmsl/sumobserver/{{ sap_swpm_sid | upper }}/analysis/SUMOBSERVER.XML" + method: GET + validate_certs: false + return_content: true + status_code: 200 + user: "{{ sap_swpm_sid | lower }}adm" + password: "{{ sap_swpm_sap_sidadm_password }}" + register: _sap_swpm_sum_push + until: _sap_swpm_sum_push.status == 200 and 'SUM4ABAP|MAIN_POSTCLEAN|EXIT|UnitWizard' in _sap_swpm_sum_push.content + retries: 60 + delay: 60 + failed_when: _sap_swpm_sum_push.status != 200 or 'SUM4ABAP|MAIN_POSTCLEAN|EXIT|UnitWizard' not in _sap_swpm_sum_push.content