Skip to content

Bugfix/passed sid is ignored #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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 changelogs/fragments/39_fixing_sid_selection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- roles/sap_control - fixing sap_sid parameter ignored in sap_control role
(https://github.com/sap-linuxlab/community.sap_operations/issues/38).
50 changes: 29 additions & 21 deletions roles/sap_control/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,37 @@
# - stop_sap_hana
# - start_sap_hana

- name: Set function list facts
ansible.builtin.set_fact:
sap_control_act_type: "{{ sap_control_function.split('_')[0] | lower }}"
sap_control_get_type: "{{ sap_control_function.split('_')[1] | lower }}"
sap_control_sap_type: "{{ sap_control_function.split('_')[2] | lower }}"

- name: Set sap_facts_param
ansible.builtin.set_fact:
sap_facts_param: "{{ sap_control_get_type }}"
# These facts were only used for the sap_system_facts module, but it doesn't accept sap_facts_param anymore.
# - name: Set function list facts
# ansible.builtin.set_fact:
# sap_control_act_type: "{{ sap_control_function.split('_')[0] | lower }}"
# sap_control_get_type: "{{ sap_control_function.split('_')[1] | lower }}"
# sap_control_sap_type: "{{ sap_control_function.split('_')[2] | lower }}"

# - name: Set sap_facts_param
# ansible.builtin.set_fact:
# sap_facts_param: "{{ sap_control_get_type }}"

# - name: Set sap_facts_param
# ansible.builtin.set_fact:
# sap_facts_param: "{{ sap_control_sap_type }}"
# when:
# - "'all' in sap_control_function"
# - "'sap' not in sap_control_sap_type"

- name: Set sap_facts_param
ansible.builtin.set_fact:
sap_facts_param: "{{ sap_control_sap_type }}"
when:
- "'all' in sap_control_function"
- "'sap' not in sap_control_sap_type"
# # When not all
# - name: Set sap_facts_param
# ansible.builtin.set_fact:
# sap_facts_param: "{{ sap_sid }}"
# when:
# - "'all' not in sap_control_function"

# When not all
- name: Set sap_facts_param
ansible.builtin.set_fact:
sap_facts_param: "{{ sap_sid }}"
when:
- "'all' not in sap_control_function"
# # Get SAP Info
# - name: Get SAP Info
# vars:
# sap_info_get_function: "get_{{ sap_control_get_type }}_{{ sap_control_sap_type }}"
# ansible.builtin.include_role:
# name: roles/sap_info

# # Get SAP Info
# - name: Get SAP Info
Expand Down
15 changes: 11 additions & 4 deletions roles/sap_control/tasks/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,21 @@

- name: Prepare - Sort sap_facts_register by sap_control_instance_type_sortorder
ansible.builtin.set_fact:
sorted_sap_facts: "{{ (sorted_sap_facts | default([]) | unique) + ( __type_list | difference(sorted_sap_facts | default([]))) }}"
sorted_sap_facts: "{{ (sorted_sap_facts | default([]) | unique) + (__type_list | difference(sorted_sap_facts | default([]))) }}"
loop: "{{ sap_control_instance_type_sortorder | reverse if funct_type == 'stop' else sap_control_instance_type_sortorder }}"
vars:
__type_list: "{{ sap_facts_register.ansible_facts.sap | selectattr('TYPE', 'equalto', item) | list }}"
when:
when:
- __type_list | length > 0


- name: Prepare - Filter sorted_sap_facts by sap_sid
ansible.builtin.set_fact:
sorted_sap_facts: "{{ sorted_sap_facts | default([])
| selectattr('SID', 'eq', sap_sid | upper)
| list }}"
when:
- not 'all' in sap_control_function

- name: Prepare - SAP Control
vars:
sap_control_execute_sid: "{{ item.SID }}"
Expand All @@ -28,4 +36,3 @@
loop: "{{ sorted_sap_facts }}"
when:
- item.InstanceType | lower == sap_type | lower
...