mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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:
parent
2761df232e
commit
f162990cb3
1 changed files with 7 additions and 3 deletions
|
@ -111,10 +111,14 @@ class ActionModule(ActionBase):
|
||||||
time.localtime(os.path.getmtime(source))
|
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:
|
if self._task._role is not None:
|
||||||
self._templar.environment.searchpath.insert(1, C.DEFAULT_ROLES_PATH)
|
searchpath.insert(1, C.DEFAULT_ROLES_PATH)
|
||||||
self._templar.environment.searchpath.insert(1, self._task._role._role_path)
|
searchpath.insert(1, self._task._role._role_path)
|
||||||
|
|
||||||
|
self._templar.environment.loader.searchpath = searchpath
|
||||||
|
|
||||||
old_vars = self._templar._available_variables
|
old_vars = self._templar._available_variables
|
||||||
self._templar.set_available_variables(temp_vars)
|
self._templar.set_available_variables(temp_vars)
|
||||||
|
|
Loading…
Reference in a new issue