mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Merge pull request #1441 from dhozac/better-error-missing-template
Improve the error message for missing files
This commit is contained in:
@@ -407,8 +407,10 @@ def template_from_file(basedir, path, vars):
|
|||||||
environment.filters['from_yaml'] = yaml.load
|
environment.filters['from_yaml'] = yaml.load
|
||||||
try:
|
try:
|
||||||
data = codecs.open(realpath, encoding="utf8").read()
|
data = codecs.open(realpath, encoding="utf8").read()
|
||||||
except:
|
except UnicodeDecodeError:
|
||||||
raise errors.AnsibleError("unable to process as utf-8: %s" % realpath)
|
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)
|
t = environment.from_string(data)
|
||||||
vars = vars.copy()
|
vars = vars.copy()
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user