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

fix unicode input for template lookup

fixes #14207
This commit is contained in:
Brian Coca 2016-01-29 10:41:57 -05:00
parent 0c237c4531
commit dd4787701f

View file

@ -22,6 +22,7 @@ import os
from ansible import constants as C from ansible import constants as C
from ansible.errors import AnsibleError from ansible.errors import AnsibleError
from ansible.plugins.lookup import LookupBase from ansible.plugins.lookup import LookupBase
from ansible.utils.unicode import to_unicode
try: try:
from __main__ import display from __main__ import display
@ -46,7 +47,7 @@ class LookupModule(LookupBase):
display.vvvv("File lookup using %s as file" % lookupfile) display.vvvv("File lookup using %s as file" % lookupfile)
if lookupfile and os.path.exists(lookupfile): if lookupfile and os.path.exists(lookupfile):
with open(lookupfile, 'r') as f: with open(lookupfile, 'r') as f:
template_data = f.read() template_data = to_unicode(f.read())
searchpath = [self._loader._basedir, os.path.dirname(lookupfile)] searchpath = [self._loader._basedir, os.path.dirname(lookupfile)]
if 'role_path' in variables: if 'role_path' in variables: