mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-03 20:02:45 +00:00
Fixes #6227 skip non-unicode strings and catch decode errors silently in template_from_string
This commit is contained in:
@@ -310,7 +310,13 @@ def template_from_string(basedir, data, vars, fail_on_undefined=False):
|
||||
if os.path.exists(filesdir):
|
||||
basedir = filesdir
|
||||
|
||||
data = data.decode('utf-8')
|
||||
# 6227
|
||||
if isinstance(data, unicode):
|
||||
try:
|
||||
data = data.decode('utf-8')
|
||||
except UnicodeEncodeError, e:
|
||||
pass
|
||||
|
||||
try:
|
||||
t = environment.from_string(data)
|
||||
except Exception, e:
|
||||
|
||||
Reference in New Issue
Block a user