1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Pass through vault_password when parsing host/group vars as directories.

Fixes a bug where vault_password parameter was not passed through in
_load_vars_from_folder()

modified:   lib/ansible/inventory/vars_plugins/group_vars.py
This commit is contained in:
Serge van Ginderachter 2014-03-17 10:51:04 +01:00
parent 47aff528b9
commit 280498a7e5

View file

@ -86,7 +86,7 @@ def _load_vars_from_path(path, results, vault_password=None):
if stat.S_ISDIR(pathstat.st_mode): if stat.S_ISDIR(pathstat.st_mode):
# support organizing variables across multiple files in a directory # support organizing variables across multiple files in a directory
return True, _load_vars_from_folder(path, results) return True, _load_vars_from_folder(path, results, vault_password=vault_password)
# regular file # regular file
elif stat.S_ISREG(pathstat.st_mode): elif stat.S_ISREG(pathstat.st_mode):
@ -105,7 +105,7 @@ def _load_vars_from_path(path, results, vault_password=None):
raise errors.AnsibleError("Expected a variable file or directory " raise errors.AnsibleError("Expected a variable file or directory "
"but found a non-file object at path %s" % (path, )) "but found a non-file object at path %s" % (path, ))
def _load_vars_from_folder(folder_path, results): def _load_vars_from_folder(folder_path, results, vault_password=None):
""" """
Load all variables within a folder recursively. Load all variables within a folder recursively.
""" """
@ -126,7 +126,7 @@ def _load_vars_from_folder(folder_path, results):
# 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('.')]
for path in paths: for path in paths:
_found, results = _load_vars_from_path(path, results) _found, results = _load_vars_from_path(path, results, vault_password=vault_password)
return results return results