Skip to content

Commit b177316

Browse files
authored
Merge pull request #39 from oxya-dev/bugfix/passed_sid_is_ignored
sap_control: Bugfix/passed sid is ignored
2 parents 58a17b4 + 25ec333 commit b177316

File tree

3 files changed

+43
-25
lines changed

3 files changed

+43
-25
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bugfixes:
2+
- roles/sap_control - fixing sap_sid parameter ignored in sap_control role
3+
(https://github.com/sap-linuxlab/community.sap_operations/issues/38).

roles/sap_control/tasks/main.yml

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,37 @@
5353
# - stop_sap_hana
5454
# - start_sap_hana
5555

56-
- name: Set function list facts
57-
ansible.builtin.set_fact:
58-
sap_control_act_type: "{{ sap_control_function.split('_')[0] | lower }}"
59-
sap_control_get_type: "{{ sap_control_function.split('_')[1] | lower }}"
60-
sap_control_sap_type: "{{ sap_control_function.split('_')[2] | lower }}"
61-
62-
- name: Set sap_facts_param
63-
ansible.builtin.set_fact:
64-
sap_facts_param: "{{ sap_control_get_type }}"
56+
# These facts were only used for the sap_system_facts module, but it doesn't accept sap_facts_param anymore.
57+
# - name: Set function list facts
58+
# ansible.builtin.set_fact:
59+
# sap_control_act_type: "{{ sap_control_function.split('_')[0] | lower }}"
60+
# sap_control_get_type: "{{ sap_control_function.split('_')[1] | lower }}"
61+
# sap_control_sap_type: "{{ sap_control_function.split('_')[2] | lower }}"
62+
63+
# - name: Set sap_facts_param
64+
# ansible.builtin.set_fact:
65+
# sap_facts_param: "{{ sap_control_get_type }}"
66+
67+
# - name: Set sap_facts_param
68+
# ansible.builtin.set_fact:
69+
# sap_facts_param: "{{ sap_control_sap_type }}"
70+
# when:
71+
# - "'all' in sap_control_function"
72+
# - "'sap' not in sap_control_sap_type"
6573

66-
- name: Set sap_facts_param
67-
ansible.builtin.set_fact:
68-
sap_facts_param: "{{ sap_control_sap_type }}"
69-
when:
70-
- "'all' in sap_control_function"
71-
- "'sap' not in sap_control_sap_type"
74+
# # When not all
75+
# - name: Set sap_facts_param
76+
# ansible.builtin.set_fact:
77+
# sap_facts_param: "{{ sap_sid }}"
78+
# when:
79+
# - "'all' not in sap_control_function"
7280

73-
# When not all
74-
- name: Set sap_facts_param
75-
ansible.builtin.set_fact:
76-
sap_facts_param: "{{ sap_sid }}"
77-
when:
78-
- "'all' not in sap_control_function"
81+
# # Get SAP Info
82+
# - name: Get SAP Info
83+
# vars:
84+
# sap_info_get_function: "get_{{ sap_control_get_type }}_{{ sap_control_sap_type }}"
85+
# ansible.builtin.include_role:
86+
# name: roles/sap_info
7987

8088
# # Get SAP Info
8189
# - name: Get SAP Info

roles/sap_control/tasks/prepare.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,21 @@
1111

1212
- name: Prepare - Sort sap_facts_register by sap_control_instance_type_sortorder
1313
ansible.builtin.set_fact:
14-
sorted_sap_facts: "{{ (sorted_sap_facts | default([]) | unique) + ( __type_list | difference(sorted_sap_facts | default([]))) }}"
14+
sorted_sap_facts: "{{ (sorted_sap_facts | default([]) | unique) + (__type_list | difference(sorted_sap_facts | default([]))) }}"
1515
loop: "{{ sap_control_instance_type_sortorder | reverse if funct_type == 'stop' else sap_control_instance_type_sortorder }}"
1616
vars:
1717
__type_list: "{{ sap_facts_register.ansible_facts.sap | selectattr('TYPE', 'equalto', item) | list }}"
18-
when:
18+
when:
1919
- __type_list | length > 0
20-
20+
21+
- name: Prepare - Filter sorted_sap_facts by sap_sid
22+
ansible.builtin.set_fact:
23+
sorted_sap_facts: "{{ sorted_sap_facts | default([])
24+
| selectattr('SID', 'eq', sap_sid | upper)
25+
| list }}"
26+
when:
27+
- not 'all' in sap_control_function
28+
2129
- name: Prepare - SAP Control
2230
vars:
2331
sap_control_execute_sid: "{{ item.SID }}"
@@ -28,4 +36,3 @@
2836
loop: "{{ sorted_sap_facts }}"
2937
when:
3038
- item.InstanceType | lower == sap_type | lower
31-
...

0 commit comments

Comments
 (0)