limit extensions for files in group/host_vars dir

inventory vars: make loading from a directory obey the same rules as
when checking the base paths, looking at the file name extensions
as defined in CONSTANTS.YAML_FILENAME_EXTENSIONS

Fixes Github issue #11017
pull/11058/head
Serge van Ginderachter 10 years ago
parent ed4df57361
commit b6ea8de399

@ -1617,7 +1617,9 @@ def _load_vars_from_folder(folder_path, results, vault_password=None):
names.sort() names.sort()
# do not parse hidden files or dirs, e.g. .svn/ # do not parse hidden files or dirs, e.g. .svn/
paths = [os.path.join(folder_path, name) for name in names if not name.startswith('.')] paths = [os.path.join(folder_path, name) for name in names
if not name.startswith('.')
and os.path.splitext(name)[1] in C.YAML_FILENAME_EXTENSIONS]
for path in paths: for path in paths:
_found, results = _load_vars_from_path(path, results, vault_password=vault_password) _found, results = _load_vars_from_path(path, results, vault_password=vault_password)
return results return results

Loading…
Cancel
Save