Remove the ternary condition for sova_config

The ternary is failing for some reason, so it is better to avoid the use
of ternary and split the task in two using the when: sova_config_file is
defined or not defined.

Change-Id: Ieb1ebe58608d2445c78942062cd9a82929ffdeb4
This commit is contained in:
Arx Cruz 2021-11-02 13:22:06 +01:00
parent 0b8d481254
commit a1138ea71d
1 changed files with 23 additions and 17 deletions

View File

@ -1,24 +1,30 @@
--- ---
- name: Load sova patterns from URL - block:
uri: - name: Load sova patterns from URL
url: https://opendev.org/openstack/tripleo-ci-health-queries/raw/branch/master/output/sova-pattern-generated.json uri:
method: GET url: https://opendev.org/openstack/tripleo-ci-health-queries/raw/branch/master/output/sova-pattern-generated.json
return_content: true method: GET
status_code: 200 return_content: true
body_format: json status_code: 200
retries: 3 # to avoid accidental failures due to networking or rate limiting body_format: json
delay: 60 retries: 3 # to avoid accidental failures due to networking or rate limiting
register: pattern_config delay: 60
register: pattern_config
- name: Set sova_config from URL content
set_fact:
sova_config: "{{ pattern_config.json }}"
when: sova_config_file is not defined when: sova_config_file is not defined
- name: Load sova patterns from local file - block:
command: cat "{{ sova_config_file }}" - name: Load sova patterns from local file
register: sova_config_file_output command: cat "{{ sova_config_file }}"
when: sova_config_file is defined register: sova_config_file_output
- name: Set sova_config json content - name: Set sova_config from local file
set_fact: set_fact:
sova_config: "{{ (sova_config_file is defined) | ternary((sova_config_file_output.stdout | from_json), pattern_config.json) }}" sova_config: "{{ sova_config_file_output.stdout | from_json }}"
when: sova_config_file is defined
- name: Run sova task - name: Run sova task
sova: sova: