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

Improve the error message for missing files

This commit is contained in:
Daniel Hokka Zakrisson 2012-10-25 00:29:30 +02:00
parent f1f44843c3
commit e216116807

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: