Skip to content

Commit

Permalink
Merge pull request #30 from ggallen/CPAAS-3659
Browse files Browse the repository at this point in the history
CPAAS-3659: Fix ordering issues.
  • Loading branch information
ggallen authored Oct 10, 2022
2 parents 3256b18 + e0708ee commit d38fcd9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
3 changes: 1 addition & 2 deletions filter_plugins/k8s_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from ansible.utils.display import Display
from ansible import constants as C
from collections import OrderedDict
import os

display = Display()
Expand All @@ -21,7 +20,7 @@ def k8s_filter(k8s_objects):
]
no_log_true = ['Secret']

resource_files = OrderedDict()
resource_files = {}
# order the resources according to what's in resource_order
for res in resource_order:
for k8s_res in k8s_objects:
Expand Down
8 changes: 4 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
namespace: "{{ openshift_project }}"
state: "{{ k8s_state }}"
validate_certs: False
definition: "{{ lookup('template', item.key) }}"
definition: "{{ lookup('template', item) }}"
no_log: "{{ global_no_log |bool }}"
with_dict: "{{ k8s_secrets }}"
with_items: "{{ k8s_secrets_ordered }}"
when: k8s_secrets | type_debug == 'dict'

- name: Creating k8s secret objects
Expand All @@ -71,8 +71,8 @@
namespace: "{{ openshift_project }}"
state: "{{ k8s_state }}"
validate_certs: False
definition: "{{ lookup('template', item.key) }}"
with_dict: "{{ k8s_resources }}"
definition: "{{ lookup('template', item) }}"
with_items: "{{ k8s_resources_ordered }}"
when: k8s_resources | type_debug == 'dict'

- name: Creating k8s objects
Expand Down
12 changes: 10 additions & 2 deletions tasks/order_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@

- name: set k8s_secrets with set files
set_fact:
k8s_secrets: "{{ k8s_secret_files | k8s_filter }}"
k8s_secrets: "{{ k8s_secret_files | k8s_filter }}"

- name: set k8s_secrets_ordered with set files
set_fact:
k8s_secrets_ordered: "{{ k8s_secret_files | k8s_filter | list }}"

- name: set k8s_resources with set files
set_fact:
k8s_resources: "{{ k8s_res_files | k8s_filter }}"
k8s_resources: "{{ k8s_res_files | k8s_filter }}"

- name: set k8s_resources_ordered with set files
set_fact:
k8s_resources_ordered: "{{ k8s_res_files | k8s_filter | list}}"

0 comments on commit d38fcd9

Please sign in to comment.