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

Correctly catch template errors without returning invalid data

Fixes #6329
This commit is contained in:
James Cammarata 2014-03-07 14:36:54 -06:00
parent c7d1c1a306
commit 3cd7d47b7e

View file

@ -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