Merge pull request #1441 from dhozac/better-error-missing-template

Improve the error message for missing files
This commit is contained in:
Michael DeHaan 2012-10-24 16:58:28 -07:00
commit 9fca4eb241

View file

@ -407,8 +407,10 @@ def template_from_file(basedir, path, vars):
environment.filters['from_yaml'] = yaml.load
try:
data = codecs.open(realpath, encoding="utf8").read()
except:
except UnicodeDecodeError:
raise errors.AnsibleError("unable to process as utf-8: %s" % realpath)
except:
raise errors.AnsibleError("unable to read %s" % realpath)
t = environment.from_string(data)
vars = vars.copy()
try: