mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
fix searched paths in DataLoader.path_dwim_relative (avoid AnsibleFileNotFound) (#26729)
* add unit test: nested dynamic includes
* nested dynamic includes: avoid AnsibleFileNotFound error
Error was:
Unable to retrieve file contents
Could not find or access 'include2.yml'
Before 8f758204cf
, at the end of
'path_dwim_relative' method, the 'search' variable contained amongst
others paths:
'/tmp/roles/testrole/tasks/tasks/included.yml' and
'/tmp/roles/testrole/tasks/included.yml'.
The commit mentioned before removed the last one despite the method
docstrings specify 'with or without explicitly named dirname subdirs'.
* add integration test: nested includes
This commit is contained in:
parent
c19d25cf67
commit
556a1daa33
5 changed files with 80 additions and 0 deletions
|
@ -304,6 +304,7 @@ class DataLoader:
|
|||
search.append(unfrackpath(os.path.join(basedir, 'tasks', source), follow=False))
|
||||
|
||||
# try to create absolute path for loader basedir + templates/files/vars + filename
|
||||
search.append(unfrackpath(os.path.join(basedir, source), follow=False))
|
||||
search.append(unfrackpath(os.path.join(dirname, source), follow=False))
|
||||
search.append(self.path_dwim(os.path.join(dirname, source)))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue