Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/modules/configuration_check_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import logging
import time
import json
import re
from typing import Optional, Dict, Any, List, Type
from datetime import datetime
from concurrent.futures import ThreadPoolExecutor
Expand Down Expand Up @@ -437,6 +438,8 @@ def validate_string(self, check: Check, collected_data: str) -> Dict[str, Any]:

if check.validator_args.get("strip_whitespace", True):
expected = str(expected).strip()
expected = re.sub(r'\s+', ' ', expected)
collected = re.sub(r'\s+', ' ', collected)

if check.validator_args.get("case_insensitive", False):
expected = expected.lower()
Expand Down
2 changes: 1 addition & 1 deletion src/modules/get_cluster_status_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _process_node_attributes(self, cluster_status_xml: ET.Element) -> Dict[str,
HanaSRProvider.ANGI: {
"clone_attr": f"hana_{self.database_sid}_clone_state",
"sync_attr": (
f"master-{self.hana_clone_resource_name}"
f"master-{self.hana_primitive_resource_name}"
if self.hana_clone_resource_name
else f"master-rsc_SAPHanaCon_{self.database_sid.upper()}"
+ f"_HDB{self.db_instance_number}"
Expand Down
25 changes: 14 additions & 11 deletions src/roles/configuration_checks/tasks/files/network.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,20 @@ checks:
command: |-
az vm nic list --resource-group {{ CONTEXT.resource_group_name }} \
--vm-name {{ CONTEXT.vm_name }} \
--subscription {{ CONTEXT.subscription_id }} \
--query "[].id" -o tsv | while read nic_id; do \
nic=$(basename "$nic_id"); \
--subscription {{ CONTEXT.subscription_id }} --query "[].id" -o tsv |
while read -r nic_id; do
nic=$(basename "$nic_id")
az network nic show --resource-group {{ CONTEXT.resource_group_name }} --name "$nic" \
--query "ipConfigurations[].{IP:privateIPAddress, Primary:primary}" -o tsv | \
while IFS=$'\t' read -r ip is_primary; do \
if [ "${is_primary,,}" = "true" ]; then \
echo "$nic: $ip Primary"; \
else \
echo "$nic: $ip Secondary"; \
fi; \
done; \
--query "ipConfigurations[].{IP:privateIPAddress, Primary:primary}" -o tsv |
while read -r line; do
ip=$(echo "$line" | awk '{print $1}')
is_primary=$(echo "$line" | awk '{print $2}' | tr -d '\r\t ' | tr '[:upper:]' '[:lower:]')
if [ "$is_primary" = "true" ]; then
echo "$nic: $ip Primary"
else
echo "$nic: $ip Secondary"
fi
done
done

report: *check
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ checks:
database_type: [*hana, *ase, *db2, *oracle]
collector_type: *command
collector_args:
command: "/bin/mdatp health"
command: "if command -v mdatp >/dev/null 2>&1; then mdatp health; else echo 'Microsoft Defender not installed'; fi"
user: *root
report: *section

Expand Down Expand Up @@ -581,7 +581,7 @@ checks:
database_type: [*hana, *ase, *db2, *oracle]
collector_type: *command
collector_args:
command: "/bin/mdatp exclusion list"
command: "if command -v mdatp >/dev/null 2>&1; then mdatp exclusion list; else echo 'Microsoft Defender not installed'; fi"
user: *root
report: *section

Expand Down
8 changes: 4 additions & 4 deletions src/roles/ha_db_hana/tasks/files/constants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ RESOURCE_DEFAULTS:
required: false
instance_attributes:
pcmk_delay_max:
value: "15"
value: ["15", "15s"]
required: false
pcmk_monitor_retries:
value: "4"
Expand Down Expand Up @@ -142,7 +142,7 @@ RESOURCE_DEFAULTS:
required: false
instance_attributes:
pcmk_delay_max:
value: "15"
value: ["15", "15s"]
required: false
pcmk_monitor_retries:
value: "4"
Expand Down Expand Up @@ -492,7 +492,7 @@ RESOURCE_DEFAULTS:
required: false
instance_attributes:
pcmk_delay_max:
value: "15"
value: ["15", "15s"]
required: false
pcmk_monitor_retries:
value: "4"
Expand Down Expand Up @@ -815,7 +815,7 @@ GLOBAL_INI:
value: "susHanaSR"
required: true
path:
value: ["/usr/share/SAPHanaSR", "/hana/shared/myHooks"]
value: ["/usr/share/SAPHanaSR-angi", "/hana/shared/myHooks"]
required: true
execution_order:
value: "1"
Expand Down
98 changes: 98 additions & 0 deletions src/roles/ha_db_hana/tasks/ha-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,104 @@
when: (ansible_os_family | upper) == "SUSE"
ansible.builtin.include_tasks: "roles/misc/tasks/get-saphanasr-provider.yml"

- name: "Pre validation: Get HANA resource id for saphanasr_angi"
when: saphanasr_provider | default('SAPHanaSR') == "SAPHanaSR-angi"
block:
- name: "Pre validation: Get HANA clone resource id for saphanasr_angi"
become: true
ansible.builtin.shell: >-
set -o pipefail && {{ commands
| selectattr('name','equalto','get_hana_clone_resource_id_saphanasr_angi')
| map(attribute=(ansible_os_family|upper))
| first
}}
args:
executable: /bin/bash
changed_when: false
register: hana_clone_resource_id
failed_when: hana_clone_resource_id.rc != 0

- name: "Pre validation: Get HANA primitive resource id for saphanasr_angi"
become: true
ansible.builtin.shell: >-
set -o pipefail && {{ commands
| selectattr('name','equalto','get_hana_primitive_resource_id_saphanasr_angi')
| map(attribute=(ansible_os_family|upper))
| first
}}
args:
executable: /bin/bash
changed_when: false
register: hana_primitive_resource_id
failed_when: hana_primitive_resource_id.rc != 0

- name: "Pre validation: Set fact the hana_clone_resource_name"
ansible.builtin.set_fact:
hana_clone_resource_name: "{{ hana_clone_resource_id.stdout }}"
hana_primitive_resource_name: "{{ hana_primitive_resource_id.stdout }}"

- name: "Pre validation: Get HANA Clone resource id"
when: saphanasr_provider | default('SAPHanaSR') == "SAPHanaSR"
block:
- name: "Try master resource ID"
become: true
ansible.builtin.shell: >-
set -o pipefail && {{ commands
| selectattr('name','equalto','get_hana_clone_resource_id')
| map(attribute=(ansible_os_family|upper))
| first
}}
args:
executable: /bin/bash
changed_when: false
register: hana_clone_resource_id
failed_when: hana_clone_resource_id.rc != 0
rescue:
- name: "Try clone resource ID"
become: true
ansible.builtin.shell: >-
set -o pipefail && {{ commands
| selectattr('name','equalto','get_hana_clone_resource_id')
| map(attribute='REDHAT')
| first
}}
args:
executable: /bin/bash
changed_when: false
register: hana_clone_resource_id
failed_when: hana_clone_resource_id.rc != 0
ignore_errors: true
always:
- name: "Test Execution: Set the resource name"
when:
- hana_clone_resource_id.rc == 0
- hana_clone_resource_id.stdout is defined
- hana_clone_resource_id.stdout | type_debug != 'NoneType'
- hana_clone_resource_id.stdout | trim | length > 1
ansible.builtin.set_fact:
hana_clone_resource_name: "{{ hana_clone_resource_id.stdout }}"

- name: "Pre validation: Get HANA Primitive resource id"
when: saphanasr_provider | default('SAPHanaSR') == "SAPHanaSR"
block:
- name: "Pre validation: Get HANA Primitive resource id"
become: true
ansible.builtin.shell: >-
set -o pipefail && {{ commands
| selectattr('name','equalto','get_hana_primitive_resource_id')
| map(attribute=(ansible_os_family|upper))
| first
}}
args:
executable: /bin/bash
changed_when: false
register: hana_primitive_resource_id
failed_when: hana_primitive_resource_id.rc != 0

- name: "Pre validation: Set fact the hana_primitive_resource_name"
ansible.builtin.set_fact:
hana_primitive_resource_name: "{{ hana_primitive_resource_id.stdout }}"

- name: "Retrieve Virtual Machine name"
ansible.builtin.uri:
url: http://169.254.169.254/metadata/instance?api-version=2021-02-01
Expand Down
2 changes: 1 addition & 1 deletion src/roles/ha_db_hana/tasks/resource-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
- name: "Test Execution: Get HANA resource id for saphanasr_angi"
ansible.builtin.shell: >-
set -o pipefail && {{ commands
| selectattr('name','equalto','get_hana_resource_id_saphanasr_angi')
| selectattr('name','equalto','get_hana_clone_resource_id_saphanasr_angi')
| map(attribute=(ansible_os_family|upper))
| first
}}
Expand Down
8 changes: 4 additions & 4 deletions src/roles/ha_scs/tasks/files/constants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ RESOURCE_DEFAULTS:
required: false
instance_attributes:
pcmk_delay_max:
value: "15"
value: ["15", "15s"]
required: false
pcmk_monitor_retries:
value: "4"
Expand Down Expand Up @@ -169,7 +169,7 @@ RESOURCE_DEFAULTS:
sbd_stonith:
instance_attributes:
pcmk_delay_max:
value: "15"
value: ["15", "15s"]
required: false
pcmk_monitor_retries:
value: "4"
Expand Down Expand Up @@ -388,7 +388,7 @@ RESOURCE_DEFAULTS:
fence_agent:
instance_attributes:
pcmk_delay_max:
value: "15"
value: ["15", "15s"]
required: false
pcmk_monitor_retries:
value: "4"
Expand Down Expand Up @@ -428,7 +428,7 @@ RESOURCE_DEFAULTS:
sbd_stonith:
instance_attributes:
pcmk_delay_max:
value: "15"
value: ["15", "15s"]
required: false
pcmk_monitor_retries:
value: "4"
Expand Down
21 changes: 18 additions & 3 deletions src/roles/misc/tasks/pre-validations-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
- name: "Pre validation: Get HANA resource id for saphanasr_angi"
when: saphanasr_provider | default('SAPHanaSR') == "SAPHanaSR-angi"
block:
- name: "Pre validation: Get HANA resource id for saphanasr_angi"
- name: "Pre validation: Get HANA clone resource id for saphanasr_angi"
become: true
ansible.builtin.shell: >-
set -o pipefail && {{ commands
| selectattr('name','equalto','get_hana_resource_id_saphanasr_angi')
| selectattr('name','equalto','get_hana_clone_resource_id_saphanasr_angi')
| map(attribute=(ansible_os_family|upper))
| first
}}
Expand All @@ -35,9 +35,24 @@
register: hana_clone_resource_id
failed_when: hana_clone_resource_id.rc != 0

- name: "Pre validation: Get HANA primitive resource id for saphanasr_angi"
become: true
ansible.builtin.shell: >-
set -o pipefail && {{ commands
| selectattr('name','equalto','get_hana_primitive_resource_id_saphanasr_angi')
| map(attribute=(ansible_os_family|upper))
| first
}}
args:
executable: /bin/bash
changed_when: false
register: hana_primitive_resource_id
failed_when: hana_primitive_resource_id.rc != 0

- name: "Pre validation: Set fact the hana_clone_resource_name"
ansible.builtin.set_fact:
hana_clone_resource_name: "{{ hana_clone_resource_id.stdout }}"
hana_clone_resource_name: "{{ hana_clone_resource_id.stdout }}"
hana_primitive_resource_name: "{{ hana_primitive_resource_id.stdout }}"

- name: "Pre validation: Get HANA Clone resource id"
when: saphanasr_provider | default('SAPHanaSR') == "SAPHanaSR"
Expand Down
2 changes: 1 addition & 1 deletion src/roles/misc/tasks/render-html-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
test_group_name: "{{ test_group_name }}_{{ ansible_os_family | upper }}"
report_template: "{{ html_report_template }}"
workspace_directory: "{{ _workspace_directory }}"
test_case_results: "{{ all_results | default({}) }}"
test_case_results: "{{ all_results | default([]) }}"
system_info: "{{ system_info | default({}) }}"
register: report_file_path
Loading
Loading