1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Tweak error messages for undefined variables feature.

This commit is contained in:
Michael DeHaan 2013-06-18 13:30:02 -04:00
parent 637983cf31
commit 5a504e3a3b
2 changed files with 3 additions and 2 deletions

View file

@ -167,6 +167,7 @@ class Runner(object):
self.complex_args = complex_args
self.module_with_list = False
self.error_on_undefined_vars = error_on_undefined_vars
print "DEBUG: EOUV: %s" % error_on_undefined_vars
self.callbacks.runner = self
@ -583,7 +584,7 @@ class Runner(object):
module_args = template.template(self.basedir, module_args, inject, fail_on_undefined=self.error_on_undefined_vars)
complex_args = template.template(self.basedir, complex_args, inject, fail_on_undefined=self.error_on_undefined_vars)
except jinja2.exceptions.UndefinedError, e:
raise errors.AnsibleUndefinedVariable("Undefined variables: %s" % str(e))
raise errors.AnsibleUndefinedVariable("One or more undefined variables: %s" % str(e))
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)

View file

@ -462,7 +462,7 @@ def template_from_file(basedir, path, vars):
try:
res = jinja2.utils.concat(t.root_render_func(t.new_context(_jinja2_vars(basedir, vars, t.globals), shared=True)))
except jinja2.exceptions.UndefinedError, e:
raise errors.AnsibleUndefinedVariable("Undefined variables: %s" % str(e))
raise errors.AnsibleUndefinedVariable("One or more undefined variables: %s" % str(e))
if data.endswith('\n') and not res.endswith('\n'):
res = res + '\n'