Skip to content

Commit

Permalink
Add default EE to fix wait for sync
Browse files Browse the repository at this point in the history
  • Loading branch information
fridim committed Feb 17, 2022
1 parent 7145b6f commit da564f1
Showing 1 changed file with 60 additions and 1 deletion.
61 changes: 60 additions & 1 deletion playbooks/service-provision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,30 @@
file: "{{ catalog_item_params_file }}"
name: catalog_item_params

# RHPDS virtualenvs -> EE automatic creation
- name: Override EE with default_execution_environment if not defined
vars:
ansible_control_plane: >-
{{ vars.catalog_item_params.__meta__.ansible_control_plane.type | default('tower') }}
execution_environment: >-
{{ vars.catalog_item_params.__meta__.deployer.execution_environment | default({}) }}
default_execution_environment:
image: image-registry.apps-dev.open.redhat.com/agnosticd/ee-{{ vars.catalog_item_params.__meta__.deployer.virtualenv | default('ansible2.9-python3.6-2021-11-30') }}
private: true

to_merge:
__meta__:
deployer:
execution_environment: "{{ default_execution_environment }}"
when: >-
ansible_control_plane == 'controller'
and execution_environment | default('', true) == ''
set_fact:
catalog_item_params: "{{ vars.catalog_item_params | combine(to_merge, recursive=True) }}"

- name: Show catalog_item_params
debug:
var: vars.catalog_item_params
Expand Down Expand Up @@ -86,8 +110,43 @@
vars.catalog_item_params != vars.catalog_item_params | combine(check_governor_job_vars)
until: r_governor is success
delay: 5
retries: 60
retries: 1
rescue:
- name: Try to print diff between catalog_item_params and governor
ignore_errors: true
register: r_diff
vars:
# Check AnarchyGovernor vars that are not listed in params_to_variables
check_governor_job_vars: >-
{{ r_governor.resources[0].spec.vars.job_vars
| default({})
| dict2items
| json_query(filter_var_query)
| items2dict
}}
filter_var_query: >-
[?!contains(`{{ filter_var_list | to_json }}`, key)]
filter_var_list: >-
{{ (vars.catalog_item_params.agnosticv_meta.params_to_variables | default({})).values() | list
+ ["agnosticv_meta"] }}
shell: |
temp1=$(mktemp --suffix=_admin_host)
temp2=$(mktemp --suffix=_governor)
cat | jq . > $temp1 <<EOF
{{ vars.catalog_item_params | to_json }}
EOF
cat | jq . > $temp2 <<EOF
{{ vars.catalog_item_params | combine(check_governor_job_vars) | to_json }}
EOF
diff -u $temp1 $temp2
rm $temp1 $temp2
- name: Print diff
when: r_diff is succeeded
debug:
msg: "{{ r_diff.stdout }}"

- name: Report failure waiting for AnarchyGovernor vars sync
fail:
msg: |-
Expand Down

0 comments on commit da564f1

Please sign in to comment.