mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 05:40:23 -07:00
refactor to catch edge cases, remove repeated code
- Move all the supported YAML file extensions into a constant - Use helper functions to avoid duplicate code for group/host vars - Catch and disallow some confusing situations, such as the presence of multiple group/host vars files for the same group/host, but with different extensions. For example having both group_vars/all.yml and group_vars/all.yaml. - Catch and report file system permission issues, symlink errors, unexpected file system objects - Trivial performance improvement from making fewer stat system calls - Restructuring that makes it easy for a following patch to support directory recursion
This commit is contained in:
parent
4a3e828b83
commit
babde9a84c
2 changed files with 99 additions and 36 deletions
|
@ -89,6 +89,10 @@ if getattr(sys, "real_prefix", None):
|
|||
else:
|
||||
DIST_MODULE_PATH = '/usr/share/ansible/'
|
||||
|
||||
# check all of these extensions when looking for yaml files for things like
|
||||
# group variables
|
||||
YAML_FILENAME_EXTENSIONS = [ "", ".yml", ".yaml" ]
|
||||
|
||||
# sections in config file
|
||||
DEFAULTS='defaults'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue