parent
d62dffafb3
commit
bf7276a4e8
3 changed files with 15 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- templating - fix error message for ``x in y`` when y is undefined (https://github.com/ansible/ansible/issues/70984)
|
|
@ -291,6 +291,10 @@ class AnsibleUndefined(StrictUndefined):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return 'AnsibleUndefined'
|
return 'AnsibleUndefined'
|
||||||
|
|
||||||
|
def __contains__(self, item):
|
||||||
|
# Return original Undefined object to preserve the first failure context
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
class AnsibleContext(Context):
|
class AnsibleContext(Context):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -706,5 +706,14 @@
|
||||||
- 'diff_result.stdout == ""'
|
- 'diff_result.stdout == ""'
|
||||||
- "diff_result.rc == 0"
|
- "diff_result.rc == 0"
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ 'x' in y }}"
|
||||||
|
ignore_errors: yes
|
||||||
|
register: error
|
||||||
|
|
||||||
|
- name: check that proper error message is emitted when in operator is used
|
||||||
|
assert:
|
||||||
|
that: "\"'y' is undefined\" in error.msg"
|
||||||
|
|
||||||
# aliases file requires root for template tests so this should be safe
|
# aliases file requires root for template tests so this should be safe
|
||||||
- include: backup_test.yml
|
- include: backup_test.yml
|
||||||
|
|
Loading…
Reference in a new issue