Commit c95d4ca0 by James Cammarata

Properly assign search path to environment.loader in template lookup

Same fix as was applied in f162990c to the action plugin

Fixes #12355
parent bde5ed96
......@@ -40,11 +40,12 @@ class LookupModule(LookupBase):
with open(lookupfile, 'r') as f:
template_data = f.read()
self._templar.environment.searchpath = [self._loader._basedir, os.path.dirname(lookupfile)]
searchpath = [self._loader._basedir, os.path.dirname(lookupfile)]
if 'role_path' in variables:
self._templar.environment.searchpath.insert(1, C.DEFAULT_ROLES_PATH)
self._templar.environment.searchpath.insert(1, variables['role_path'])
searchpath.insert(1, C.DEFAULT_ROLES_PATH)
searchpath.insert(1, variables['role_path'])
self._templar.environment.loader.searchpath = searchpath
res = self._templar.template(template_data, preserve_trailing_newlines=True)
ret.append(res)
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment