From b6ea8de39999ccf67c0afcbeceb27345ab1cbb54 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Sat, 23 May 2015 20:30:08 +0200 Subject: [PATCH] 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 --- lib/ansible/utils/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 476a1e28e8..eb6fa2a712 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -1617,7 +1617,9 @@ def _load_vars_from_folder(folder_path, results, vault_password=None): names.sort() # 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: _found, results = _load_vars_from_path(path, results, vault_password=vault_password) return results