This repository has been archived by the owner on Jun 26, 2019. It is now read-only.
forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fileglob: make fileglob work with globbed path components again
PR ansible#16630 broke globbing in with_fileglob for globbed path components by changing from path_dwim_relative to path_dwim_relative_stack. While the former does something like this (for a path specification like "/tmp/*/some.conf", see Issue ansible#17136 for an example playbook) search = ["/tmp/*"] for candidate in search: if os.path.exists(candidate): break return candidate the check inside path_dwim_relative_stack works slightly differently: result = None if os.path.exists("/tmp/*"): result = "/tmp/*" return result The way the loop in the former example works makes path_dwim_relative return the last element from the 'search' list even if os.path.exists never returned True, while path_dwim_relative_stack returns None in the same case. This ultimately makes the fileglob plugin fail because find_file_in_search_path returns None now. To allow asterisks in paths again, this change breaks the search for potential targets out of path_dwim_relative_stack. This function can then be called from the fileglob plugin to find all potential target directories without checking if these dirs (like "/tmp/*") actually exist. fileglob will now apply globbing first and check for the actual existence of the files _after_ globbing.
- Loading branch information
Showing
4 changed files
with
97 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters