Properly assign the searchpath for templates to the environment loader

dbd755e0 previously assigned the value to self._templar.environment.searchpath,
which is incorrect - it needs to be assigned to the environment.loader.searchpath
value instead.

Fixes #11931
This commit is contained in:
James Cammarata 2015-09-01 17:33:14 -04:00
parent 2761df232e
commit f162990cb3

View file

@ -111,10 +111,14 @@ class ActionModule(ActionBase):
time.localtime(os.path.getmtime(source))
)
self._templar.environment.searchpath = [self._loader._basedir, os.path.dirname(source)]
# Create a new searchpath list to assign to the templar environment's file
# loader, so that it knows about the other paths to find template files
searchpath = [self._loader._basedir, os.path.dirname(source)]
if self._task._role is not None:
self._templar.environment.searchpath.insert(1, C.DEFAULT_ROLES_PATH)
self._templar.environment.searchpath.insert(1, self._task._role._role_path)
searchpath.insert(1, C.DEFAULT_ROLES_PATH)
searchpath.insert(1, self._task._role._role_path)
self._templar.environment.loader.searchpath = searchpath
old_vars = self._templar._available_variables
self._templar.set_available_variables(temp_vars)