From 8c7828d4690d79d2487ba60c5bf0197dd29ba675 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 25 Mar 2014 11:56:55 -0500 Subject: [PATCH] Tweaking error message resulting from undefined template variables Fixes #5114 --- lib/ansible/utils/template.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils/template.py b/lib/ansible/utils/template.py index 0b86954e882..2f79d6ca591 100644 --- a/lib/ansible/utils/template.py +++ b/lib/ansible/utils/template.py @@ -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