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.

Closes-Bug: #1849747
Change-Id: I443bc36ca8808e1547da37f207b011031120067f
Signed-off-by: Kevin Carter <kecarter@redhat.com>
(cherry picked from commit 51469aab2e)
This commit is contained in:
Kevin Carter 2019-09-27 14:44:43 -05:00 committed by Alex Schultz
parent 5305e48e3e
commit 94ea0b6226
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

@ -89,6 +89,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