mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-01 08:13:08 +00: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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user