Merge pull request #11735 from mscherer/fix_10273
Document and test 'is undefined' rather than 'is not defined'pull/4420/head
commit
c7c5b40aa8
|
@ -90,7 +90,7 @@ If a required variable has not been set, you can skip or fail using Jinja2's
|
||||||
when: foo is defined
|
when: foo is defined
|
||||||
|
|
||||||
- fail: msg="Bailing out. this play requires 'bar'"
|
- fail: msg="Bailing out. this play requires 'bar'"
|
||||||
when: bar is not defined
|
when: bar is undefined
|
||||||
|
|
||||||
This is especially useful in combination with the conditional import of vars
|
This is especially useful in combination with the conditional import of vars
|
||||||
files (see below).
|
files (see below).
|
||||||
|
|
|
@ -148,6 +148,16 @@
|
||||||
that:
|
that:
|
||||||
- "result.skipped == true"
|
- "result.skipped == true"
|
||||||
|
|
||||||
|
- name: test bad conditional 'is undefined'
|
||||||
|
shell: echo 'testing'
|
||||||
|
when: test_bare is undefined
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- name: assert bad conditional 'is undefined' did NOT run
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "result.skipped == true"
|
||||||
|
|
||||||
- name: test bare conditional
|
- name: test bare conditional
|
||||||
shell: echo 'testing'
|
shell: echo 'testing'
|
||||||
when: test_bare
|
when: test_bare
|
||||||
|
|
Loading…
Reference in New Issue