Skip to content

Commit 574052f

Browse files
committed
Refactor playbook name determination and update configuration checks for improved clarity and functionality
1 parent b11e497 commit 574052f

File tree

5 files changed

+74
-57
lines changed

5 files changed

+74
-57
lines changed

scripts/sap_automation_qa.sh

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -194,37 +194,49 @@ extract_error_message() {
194194
echo "$extracted_message"
195195
}
196196

197-
# Determine the playbook name based on the SAP_FUNCTIONAL_TEST_TYPE.
198-
# :param test_type: The type of SAP functional test.
197+
# Determine the playbook name based on TEST_TYPE and SAP_FUNCTIONAL_TEST_TYPE.
198+
# :param test_type: The overall test type (e.g., "SAPFunctionalTests", "ConfigurationChecks").
199+
# :param sap_functional_test_type: The specific SAP functional test type (e.g., "DatabaseHighAvailability", "CentralServicesHighAvailability").
199200
# :param offline_mode: Whether to use offline mode (optional).
200201
# :return: The name of the playbook.
201202
get_playbook_name() {
202203
local test_type=$1
203-
local offline_mode=${2:-""}
204+
local sap_functional_test_type=$2
205+
local offline_mode=${3:-""}
204206

205-
case "$test_type" in
206-
"DatabaseHighAvailability")
207-
if [[ "$offline_mode" == "true" ]]; then
208-
echo "playbook_01_ha_offline_tests"
209-
else
210-
echo "playbook_00_ha_db_functional_tests"
211-
fi
212-
;;
213-
"CentralServicesHighAvailability")
214-
if [[ "$offline_mode" == "true" ]]; then
215-
echo "playbook_01_ha_offline_tests"
216-
else
217-
echo "playbook_00_ha_scs_functional_tests"
218-
fi
219-
;;
220-
"ConfigurationChecks")
221-
echo "playbook_00_configuration_checks"
222-
;;
223-
*)
224-
log "ERROR" "Unknown SAP_FUNCTIONAL_TEST_TYPE: $test_type"
225-
exit 1
226-
;;
227-
esac
207+
if [[ "$test_type" == "ConfigurationChecks" ]]; then
208+
echo "playbook_00_configuration_checks"
209+
return
210+
fi
211+
212+
if [[ "$test_type" == "SAPFunctionalTests" ]]; then
213+
case "$sap_functional_test_type" in
214+
"DatabaseHighAvailability")
215+
if [[ "$offline_mode" == "true" ]]; then
216+
echo "playbook_01_ha_offline_tests"
217+
else
218+
echo "playbook_00_ha_db_functional_tests"
219+
fi
220+
;;
221+
"CentralServicesHighAvailability")
222+
if [[ "$offline_mode" == "true" ]]; then
223+
echo "playbook_01_ha_offline_tests"
224+
else
225+
echo "playbook_00_ha_scs_functional_tests"
226+
fi
227+
;;
228+
"ConfigurationChecks")
229+
echo "playbook_00_configuration_checks"
230+
;;
231+
*)
232+
log "ERROR" "Unknown SAP_FUNCTIONAL_TEST_TYPE: $sap_functional_test_type"
233+
exit 1
234+
;;
235+
esac
236+
return
237+
fi
238+
log "ERROR" "Unknown TEST_TYPE: $test_type. Expected 'SAPFunctionalTests' or 'ConfigurationCheck'"
239+
exit 1
228240
}
229241

230242
# Generate filtered test configuration as JSON for Ansible extra vars
@@ -527,7 +539,7 @@ main() {
527539
log "INFO" "Found $cib_files CIB file(s) for offline analysis"
528540
fi
529541

530-
playbook_name=$(get_playbook_name "$SAP_FUNCTIONAL_TEST_TYPE" "$OFFLINE_MODE")
542+
playbook_name=$(get_playbook_name "$TEST_TYPE" "$SAP_FUNCTIONAL_TEST_TYPE" "$OFFLINE_MODE")
531543
log "INFO" "Using playbook: $playbook_name."
532544

533545
run_ansible_playbook "$playbook_name" "$SYSTEM_HOSTS" "$SYSTEM_PARAMS" "$AUTHENTICATION_TYPE" "$SYSTEM_CONFIG_FOLDER"

src/roles/configuration_checks/tasks/disks.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
- name: Collect device-to-lun mapping from Azure symlinks
4343
ansible.builtin.shell:
44+
executable: /bin/bash
4445
cmd: |
4546
set -o pipefail
4647
for lun_link in /dev/disk/azure/scsi1/lun*; do
@@ -100,7 +101,9 @@
100101
when: NFS_provider is defined and 'ANF' in NFS_provider and ANF_account_rg is defined and ANF_account_name is defined
101102
register: anf_storage_metadata_results
102103
delegate_to: localhost
103-
ansible.builtin.shell: |
104+
ansible.builtin.shell:
105+
executable: /bin/bash
106+
cmd: |
104107
set -o pipefail
105108
printf "["
106109
first=true
@@ -144,7 +147,9 @@
144147
when: NFS_provider is defined and 'AFS' in NFS_provider
145148
register: afs_storage_metadata_results
146149
delegate_to: localhost
147-
ansible.builtin.shell: |
150+
ansible.builtin.shell:
151+
executable: /bin/bash
152+
cmd: |
148153
set -o pipefail
149154
for sa in $(az storage account list \
150155
--query "[?kind=='FileStorage'].{rg:resourceGroup,name:name,id:id}" \

src/roles/configuration_checks/tasks/files/ascs.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ checks:
9292
severity: *high
9393
workload: *sap
9494
applicability:
95-
- os_type: [*suse, *redhat]
96-
- os_version: *all_versions
97-
- hardware_type: *vm
98-
- storage_type: *all_storage
99-
- role: [*ascs_role, *db_role]
100-
- database_type: *db
101-
- high_availability: true
102-
- high_availability_agent: *cluster_type
95+
os_type: [*suse, *redhat]
96+
os_version: *all_versions
97+
hardware_type: *vm
98+
storage_type: *all_storage
99+
role: [*ascs_role, *db_role]
100+
database_type: *db
101+
high_availability: true
102+
high_availability_agent: *cluster_type
103103
collector_type: *command
104104
collector_args:
105105
command: "/sbin/sysctl net.ipv4.tcp_timestamps -n"

src/roles/configuration_checks/tasks/files/hana.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ checks:
829829
references:
830830
sap: "1999997"
831831

832-
- id: DB-HANA-0033
832+
- id: "DB-HANA-0033"
833833
name: "Filesystem type for /hana/data"
834834
description: "The filesystem type for /hana/data should be xfs or nfs or nfs4"
835835
category: *sap_check
@@ -853,7 +853,7 @@ checks:
853853
references:
854854
sap: "2972496"
855855

856-
- id: DB-HANA-0034
856+
- id: "DB-HANA-0034"
857857
name: "Stripe size for /hana/data"
858858
description: "The stripe size for /hana/data should be 256k (256.00k or 262144 bytes)"
859859
category: *sap_check
@@ -879,7 +879,7 @@ checks:
879879
sap: "2972496"
880880
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
881881

882-
- id: DB-HANA-0035
882+
- id: "DB-HANA-0035"
883883
name: "Filesystem type for /hana/log"
884884
description: "The filesystem type for /hana/log should be xfs or nfs or nfs4"
885885
category: *sap_check
@@ -903,7 +903,7 @@ checks:
903903
references:
904904
sap: "2972496"
905905

906-
- id: DB-HANA-0036
906+
- id: "DB-HANA-0036"
907907
name: "Stripe size for /hana/log"
908908
description: "The stripe size for /hana/log should be 256k (256.00k or 262144 bytes)"
909909
category: *sap_check
@@ -929,7 +929,7 @@ checks:
929929
sap: "2972496"
930930
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
931931

932-
- id: DB-HANA-0037
932+
- id: "DB-HANA-0037"
933933
name: "Filesystem type for /hana/shared"
934934
description: "The filesystem type for /hana/shared should be xfs or nfs or nfs4"
935935
category: *sap_check
@@ -953,7 +953,7 @@ checks:
953953
references:
954954
sap: "2972496"
955955

956-
- id: DB-HANA-0038
956+
- id: "DB-HANA-0038"
957957
name: "Filesystem type for /usr/sap"
958958
description: "The filesystem type for /usr/sap should be xfs or nfs or nfs4"
959959
category: *sap_check
@@ -977,7 +977,7 @@ checks:
977977
references:
978978
sap: "2972496"
979979

980-
- id: DB-HANA-0039
980+
- id: "DB-HANA-0039"
981981
name: "Sector size for /hana/data Premium SSD V2"
982982
description: "The logical block size for /hana/data on Premium SSD V2 should be 4096 bytes"
983983
category: *sap_check
@@ -1001,7 +1001,7 @@ checks:
10011001
references:
10021002
sap: "2972496"
10031003

1004-
- id: DB-HANA-0040
1004+
- id: "DB-HANA-0040"
10051005
name: "Sector size for /hana/log Premium SSD V2"
10061006
description: "The logical block size for /hana/log on Premium SSD V2 should be 4096 bytes"
10071007
category: *sap_check
@@ -1025,7 +1025,7 @@ checks:
10251025
references:
10261026
sap: "2972496"
10271027

1028-
- id: DB-HANA-0041
1028+
- id: "DB-HANA-0041"
10291029
name: "Disk performance for /hana/data (MBPS)"
10301030
description: "The disk performance for /hana/data should be >= 400 MByte/s"
10311031
category: *sap_check
@@ -1051,7 +1051,7 @@ checks:
10511051
sap: "2972496"
10521052
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
10531053

1054-
- id: DB-HANA-0042
1054+
- id: "DB-HANA-0042"
10551055
name: "Disk performance for /hana/data (IOPS)"
10561056
description: "The disk performance for /hana/data should be >= 7000 IOPS"
10571057
category: *sap_check
@@ -1077,7 +1077,7 @@ checks:
10771077
sap: "2972496"
10781078
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
10791079

1080-
- id: DB-HANA-0043
1080+
- id: "DB-HANA-0043"
10811081
name: "Disk performance for /hana/log (MBPS)"
10821082
description: "The disk performance for /hana/log should be >= 250 MByte/s"
10831083
category: *sap_check
@@ -1103,7 +1103,7 @@ checks:
11031103
sap: "2972496"
11041104
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
11051105

1106-
- id: DB-HANA-0044
1106+
- id: "DB-HANA-0044"
11071107
name: "Disk performance for /hana/log (IOPS)"
11081108
description: "The disk performance for /hana/log should be >= 7000 IOPS"
11091109
category: *sap_check
@@ -1129,7 +1129,7 @@ checks:
11291129
sap: "2972496"
11301130
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
11311131

1132-
- id: DB-HANA-0045
1132+
- id: "DB-HANA-0045"
11331133
name: "Filesystem Mount Points"
11341134
description: "Lists all mounted filesystems and their types to ensure SAP HANA directories are configured with supported filesystems."
11351135
category: *sap_check
@@ -1150,7 +1150,7 @@ checks:
11501150
sap: "2972496"
11511151
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
11521152

1153-
- id: DB-HANA-0046
1153+
- id: "DB-HANA-0046"
11541154
name: "Azure Disks"
11551155
description: "Lists all attached Azure disks to ensure SAP HANA directories are configured with supported disks."
11561156
category: *sap_check
@@ -1171,7 +1171,7 @@ checks:
11711171
sap: "2972496"
11721172
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
11731173

1174-
- id: DB-HANA-0047
1174+
- id: "DB-HANA-0047"
11751175
name: "LVM Groups"
11761176
description: "Lists all LVM groups to ensure SAP HANA directories are configured with supported LVM configurations."
11771177
category: *sap_check
@@ -1192,7 +1192,7 @@ checks:
11921192
sap: "2972496"
11931193
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
11941194

1195-
- id: DB-HANA-0048
1195+
- id: "DB-HANA-0048"
11961196
name: "LVM Volumes"
11971197
description: "Lists all LVM volumes to ensure SAP HANA directories are configured with supported LVM configurations."
11981198
category: *sap_check
@@ -1213,7 +1213,7 @@ checks:
12131213
sap: "2972496"
12141214
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
12151215

1216-
- id: DB-HANA-0049
1216+
- id: "DB-HANA-0049"
12171217
name: "ANF Volumes"
12181218
description: "Lists all ANF volumes to ensure SAP HANA directories are configured with supported ANF configurations."
12191219
category: *sap_check
@@ -1234,7 +1234,7 @@ checks:
12341234
sap: "2972496"
12351235
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
12361236

1237-
- id: DB-HANA-0050
1237+
- id: "DB-HANA-0050"
12381238
name: "Disk performance for /hana/data (MBPS)"
12391239
description: "The disk performance for /hana/data should be >= 400 MByte/s"
12401240
category: *sap_check
@@ -1260,7 +1260,7 @@ checks:
12601260
sap: "2972496"
12611261
microsoft: "https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/sap/hana-vm-operations-storage"
12621262

1263-
- id: DB-HANA-0051
1263+
- id: "DB-HANA-0051"
12641264
name: "Disk performance for /hana/data (MBPS)"
12651265
description: "The disk performance for /hana/data should be >= 400 MByte/s"
12661266
category: *sap_check

src/roles/configuration_checks/tasks/files/virtual_machine.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ checks:
884884
report: *check
885885

886886

887-
- id: "IC-0039"
887+
- id: "IC-0040"
888888
name: "Cluster Configuration"
889889
description: "Checks the cluster configuration of the system"
890890
category: *sap_check

0 commit comments

Comments
 (0)