mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Use default on undefined vars in tests. (#17601)
This commit is contained in:
parent
c17a3bac37
commit
355b29573c
2 changed files with 2 additions and 2 deletions
|
@ -281,7 +281,7 @@
|
||||||
- block:
|
- block:
|
||||||
- name: test a with_items loop using a variable with a missing attribute
|
- name: test a with_items loop using a variable with a missing attribute
|
||||||
debug: var=item
|
debug: var=item
|
||||||
with_items: "{{cond_bad_attribute.results}}"
|
with_items: "{{cond_bad_attribute.results | default('')}}"
|
||||||
register: result
|
register: result
|
||||||
- set_fact: skipped_bad_attribute=False
|
- set_fact: skipped_bad_attribute=False
|
||||||
- name: assert the task was skipped
|
- name: assert the task was skipped
|
||||||
|
|
|
@ -8,5 +8,5 @@ things1:
|
||||||
- 2
|
- 2
|
||||||
things2:
|
things2:
|
||||||
- "{{ foo }}"
|
- "{{ foo }}"
|
||||||
- "{{ foob }}"
|
- "{{ foob | default('') }}"
|
||||||
vars_file_var: 321
|
vars_file_var: 321
|
||||||
|
|
Loading…
Reference in a new issue