Skip to content

Commit bf6b94f

Browse files
committed
Fix conditionals/var acess broken with ansible 2.9
Non boolean conditionals are not allowed in ansible 2.19. Fix private var access from namespace not allowed Depends-On: openstack-k8s-operators/openstack-operator#1547 Depends-On: openstack-k8s-operators/ci-framework#3168 Signed-off-by: rabi <[email protected]>
1 parent 0cb6a70 commit bf6b94f

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

roles/edpm_kernel/tasks/hugepages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_converted_hugepages: {}
2020
_nonconfig_hugepages: {}
2121
_hugepages_modification: false
22-
when: edpm_kernel_hugepages | length
22+
when: edpm_kernel_hugepages | default({}) | length > 0
2323
block:
2424
- name: Rewrite edpm_kernel_hugepages to use integers as keys
2525
ansible.builtin.set_fact:

roles/edpm_libvirt/tasks/virsh-secret.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
KEY: "{{ cephx_key.stdout | regex_replace('\"', '') }}"
3939
when:
4040
- cephx_key.stdout is defined
41-
- cephx_key.stdout | regex_replace('\"', '') | regex_search('^[a-zA-Z0-9+/]{38}==$')
41+
- cephx_key.stdout | regex_replace('\"', '') | regex_search('^[a-zA-Z0-9+/]{38}==$') | length > 0
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
{%- set ns = namespace(_dport='') %}
1+
{%- set ns = namespace(dport='') %}
22
{%- if 'dport' in rule %}
33
{% if rule['dport'] is iterable and (rule['dport'] is not string and rule['dport'] is not mapping) -%}
4-
{% set ns._dport = rule['dport'] |join(', ') -%}
4+
{% set ns.dport = rule['dport'] |join(', ') -%}
55
{% else -%}
6-
{% set ns._dport = rule['dport'] -%}
6+
{% set ns.dport = rule['dport'] -%}
77
{% endif -%}
88
{%- endif %}
99
{#- This is for legacy things - Really, use dport... #}
1010
{%- if 'port' in rule %}
1111
{% if rule['port'] is iterable and (rule['port'] is not string and rule['port'] is not mapping) -%}
12-
{% set ns._dport = rule['port'] |join(', ') -%}
12+
{% set ns.dport = rule['port'] |join(', ') -%}
1313
{% else -%}
14-
{% set ns._dport = rule['port'] -%}
14+
{% set ns.dport = rule['port'] -%}
1515
{% endif -%}
1616
{%- endif %}
17-
{%- if ns._dport != '' %}
18-
{{ rule.get('proto', false)|ternary('', 'tcp ') }}dport { {{ ns._dport |replace(':', '-') }} }
17+
{%- if ns.dport != '' %}
18+
{{ rule.get('proto', false)|ternary('', 'tcp ') }}dport { {{ ns.dport |replace(':', '-') }} }
1919
{%- endif %}

roles/edpm_ovs_dpdk/tasks/configure.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
- name: Check valid input for edpm_ovs_dpdk_pmd_core_list
1818
ansible.builtin.fail:
1919
msg: "List of PMD cores cannot be empty - edpm_ovs_dpdk_pmd_core_list"
20-
when: not edpm_ovs_dpdk_pmd_core_list|string or edpm_ovs_dpdk_pmd_core_list == 'null'
20+
when: edpm_ovs_dpdk_pmd_core_list|string|length == 0 or edpm_ovs_dpdk_pmd_core_list == 'null'
2121

2222
- name: PMD cores config
23-
when: edpm_ovs_dpdk_pmd_core_list|string
23+
when: edpm_ovs_dpdk_pmd_core_list|string|length > 0
2424
block:
2525
- name: Apply PMD cores config
2626
ansible.builtin.set_fact:
@@ -47,7 +47,7 @@
4747
edpm_ovs_other_config: "{{ edpm_ovs_other_config | combine(dpdk_extra) }}"
4848

4949
- name: Set socket-mem and socket-limit config
50-
when: edpm_ovs_dpdk_socket_memory|string
50+
when: edpm_ovs_dpdk_socket_memory|string|length > 0
5151
block:
5252
- name: Apply socket-mem config
5353
ansible.builtin.set_fact:
@@ -64,7 +64,7 @@
6464
edpm_ovs_other_config: "{{ edpm_ovs_other_config | combine(dpdk_socket_mem) | combine(dpdk_socket_limit) }}"
6565

6666
- name: Set Revalidator threads config
67-
when: edpm_ovs_dpdk_revalidator_cores|string
67+
when: edpm_ovs_dpdk_revalidator_cores|string|length > 0
6868
block:
6969
- name: Apply Revalidator threads config
7070
ansible.builtin.set_fact:
@@ -76,7 +76,7 @@
7676
edpm_ovs_other_config: "{{ edpm_ovs_other_config | combine(n_revalidator_threads) }}"
7777

7878
- name: Set Handler threads config
79-
when: edpm_ovs_dpdk_handler_cores|string
79+
when: edpm_ovs_dpdk_handler_cores|string|length > 0
8080
block:
8181
- name: Apply Handler threads config
8282
ansible.builtin.set_fact:
@@ -88,7 +88,7 @@
8888
edpm_ovs_other_config: "{{ edpm_ovs_other_config | combine(n_handler_threads) }}"
8989

9090
- name: Set EMC Insertion Probability config
91-
when: edpm_ovs_dpdk_emc_insertion_probablity|string
91+
when: edpm_ovs_dpdk_emc_insertion_probablity|string|length > 0
9292
block:
9393
- name: Apply EMC Insertion Probability config
9494
ansible.builtin.set_fact:
@@ -149,7 +149,7 @@
149149
edpm_ovs_other_config: "{{ edpm_ovs_other_config | combine(pmd_auto_lb) }}"
150150

151151
- name: Set minimum PMD thread load threshold
152-
when: edpm_ovs_dpdk_pmd_load_threshold|string
152+
when: edpm_ovs_dpdk_pmd_load_threshold|string|length > 0
153153
block:
154154
- name: Apply minimum PMD thread load threshold
155155
ansible.builtin.set_fact:
@@ -161,7 +161,7 @@
161161
edpm_ovs_other_config: "{{ edpm_ovs_other_config | combine(pmd_auto_lb_load_threshold) }}"
162162

163163
- name: Set PMD load variance improvement threshold
164-
when: edpm_ovs_dpdk_pmd_improvement_threshold|string
164+
when: edpm_ovs_dpdk_pmd_improvement_threshold|string|length > 0
165165
block:
166166
- name: Apply PMD load variance improvement threshold
167167
ansible.builtin.set_fact:
@@ -173,7 +173,7 @@
173173
edpm_ovs_other_config: "{{ edpm_ovs_other_config | combine(pmd_auto_lb_improvement_threshold) }}"
174174

175175
- name: Set PMD auto load balancing interval
176-
when: edpm_ovs_dpdk_pmd_rebal_interval|string
176+
when: edpm_ovs_dpdk_pmd_rebal_interval|string|length > 0
177177
block:
178178
- name: Apply PMD auto load balancing interval
179179
ansible.builtin.set_fact:
@@ -185,7 +185,7 @@
185185
edpm_ovs_other_config: "{{ edpm_ovs_other_config | combine(pmd_auto_lb_rebal_interval) }}"
186186

187187
- name: OVN bridge datapath type config
188-
when: edpm_ovn_datapath_type|string
188+
when: edpm_ovn_datapath_type|string|length > 0
189189
block:
190190
- name: Apply PMD cores config
191191
ansible.builtin.set_fact:
@@ -197,7 +197,7 @@
197197
edpm_ovs_external_ids: "{{ {} | combine(ovn_bridge_datapath_type) }}"
198198

199199
- name: Set shared memory pool config
200-
when: edpm_ovs_dpdk_shared_mem_pool|string
200+
when: edpm_ovs_dpdk_shared_mem_pool|string|length > 0
201201
block:
202202
- name: Apply shared memory pool config
203203
ansible.builtin.set_fact:
@@ -209,7 +209,7 @@
209209
edpm_ovs_other_config: "{{ edpm_ovs_other_config | combine(dpdk_shared_mem_pool) }}"
210210

211211
- name: Set PMD maximum sleep time
212-
when: edpm_ovs_dpdk_pmd_sleep_max|string
212+
when: edpm_ovs_dpdk_pmd_sleep_max|string|length > 0
213213
block:
214214
- name: Apply PMD maximum sleep time
215215
ansible.builtin.set_fact:

roles/edpm_pre_adoption_validation/tasks/kernel_args.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@
4141
# In the other hand neither the edpm_kernel role during deployment and
4242
# adoption nor this adoption check enforces to list the existing kernel args
4343
# in edpm_kernel_args ansible variable.
44-
failed_when: not (cmdline | regex_search( '^.*' + edpm_kernel_args | default('') + '.*$' | string ))
44+
failed_when: not (cmdline | regex_search( '^.*' + edpm_kernel_args | default('') + '.*$' | string))

roles/edpm_ssh_known_hosts/tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848

4949
- name: Gather facts if they don't exist
5050
when:
51-
- ("'ssh_host_key_rsa_public' not in ansible_facts") or
52-
("'ssh_host_key_ed25519_public' not in ansible_facts") or
53-
("'ssh_host_key_ecdsa_public' not in ansible_facts")
51+
- ('ssh_host_key_rsa_public' not in ansible_facts) or
52+
('ssh_host_key_ed25519_public' not in ansible_facts) or
53+
('ssh_host_key_ecdsa_public' not in ansible_facts)
5454
ansible.builtin.setup:
5555
gather_subset:
5656
- "!all"

0 commit comments

Comments
 (0)