Merge pull request #6332 from jimi-c/issue_6329_space_in_var
Correctly catch template errors without returning invalid data
This commit is contained in:
commit
4753804ab4
1 changed files with 2 additions and 0 deletions
|
@ -316,6 +316,8 @@ def template_from_string(basedir, data, vars, fail_on_undefined=False):
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
if 'recursion' in str(e):
|
if 'recursion' in str(e):
|
||||||
raise errors.AnsibleError("recursive loop detected in template string: %s" % data)
|
raise errors.AnsibleError("recursive loop detected in template string: %s" % data)
|
||||||
|
elif isinstance(e, TemplateSyntaxError):
|
||||||
|
raise errors.AnsibleError("there was an error in the template: %s" % data)
|
||||||
else:
|
else:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue