Add second fact to ensure type safty

The logins json can be both a hash and a string, depending on how it is
being set by the deployer. To ensure that we're able to cover both cases
this change will test the initial data type and react accordingly.

Change-Id: I443bc36ca8808e1547da37f207b011031120067f
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2019-09-27 14:44:43 -05:00
parent 2317c48e70
commit 51469aab2e
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A
2 changed files with 17 additions and 0 deletions

View File

@ -168,6 +168,14 @@ outputs:
set_fact:
container_registry_logins: "{{ container_registry_logins_json | from_json }}"
when:
- container_registry_logins_json is string
- container_registry_login | bool
- (container_registry_logins_json | length) > 0
- name: Set registry logins
set_fact:
container_registry_logins: "{{ container_registry_logins_json }}"
when:
- container_registry_logins_json is mapping
- container_registry_login | bool
- (container_registry_logins_json | length) > 0
- include_role:

View File

@ -90,6 +90,15 @@ outputs:
set_fact:
container_registry_logins: "{{ container_registry_logins_json | from_json }}"
when:
- container_registry_logins_json is string
- container_registry_login | bool
- (container_registry_logins_json | length) > 0
- name: Set registry logins
set_fact:
container_registry_logins: "{{ container_registry_logins_json }}"
when:
- container_registry_logins_json is mapping
- container_registry_login | bool
- (container_registry_logins_json | length) > 0