Remove redundant undefined error message (#81867)

Fixes: #78703

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/82628/head
Abhijeet Kasurde 2 years ago committed by GitHub
parent bec27fb4c0
commit 7a0c321054
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,3 @@
---
bugfixes:
- Do not print undefined error message twice (https://github.com/ansible/ansible/issues/78703).

@ -1011,12 +1011,16 @@ class Templar:
if unsafe: if unsafe:
res = wrap_var(res) res = wrap_var(res)
return res return res
except (UndefinedError, AnsibleUndefinedVariable) as e: except UndefinedError as e:
if fail_on_undefined: if fail_on_undefined:
raise AnsibleUndefinedVariable(e, orig_exc=e) raise AnsibleUndefinedVariable(e)
else: display.debug("Ignoring undefined failure: %s" % to_text(e))
display.debug("Ignoring undefined failure: %s" % to_text(e)) return data
return data except AnsibleUndefinedVariable as e:
if fail_on_undefined:
raise
display.debug("Ignoring undefined failure: %s" % to_text(e))
return data
# for backwards compatibility in case anyone is using old private method directly # for backwards compatibility in case anyone is using old private method directly
_do_template = do_template _do_template = do_template

@ -714,7 +714,7 @@
- name: check that proper error message is emitted when in operator is used - name: check that proper error message is emitted when in operator is used
assert: assert:
that: "\"'y' is undefined\" in error.msg" that: "\"The error was: 'y' is undefined\n\n\" in error.msg"
- template: - template:
src: template_import_macro_globals.j2 src: template_import_macro_globals.j2

Loading…
Cancel
Save