mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Tweaking error message resulting from undefined template variables
Fixes #5114
This commit is contained in:
parent
846933dd53
commit
8c7828d469
1 changed files with 4 additions and 1 deletions
|
@ -338,7 +338,10 @@ def template_from_string(basedir, data, vars, fail_on_undefined=False):
|
|||
res = jinja2.utils.concat(rf)
|
||||
except TypeError, te:
|
||||
if 'StrictUndefined' in str(te):
|
||||
raise errors.AnsibleUndefinedVariable("unable to look up a name or access an attribute in template string")
|
||||
raise errors.AnsibleUndefinedVariable(
|
||||
"Unable to look up a name or access an attribute in template string. " + \
|
||||
"Make sure your variable name does not contain invalid characters like '-'."
|
||||
)
|
||||
else:
|
||||
raise errors.AnsibleError("an unexpected type error occured. Error was %s" % te)
|
||||
return res
|
||||
|
|
Loading…
Reference in a new issue