Do not combine group_vars with an empty file

This addresses a specific case with multiple vars files
in a group_vars/${groupname}/ directory where one of those files
is empty, which returns None instead of an empty dict.
This commit is contained in:
Serge van Ginderachter 2015-07-14 00:14:13 +02:00
parent c4b6d91275
commit 9c8f0da327

View file

@ -308,7 +308,8 @@ class VariableManager:
paths = [os.path.join(path, name) for name in names if not name.startswith('.')] paths = [os.path.join(path, name) for name in names if not name.startswith('.')]
for p in paths: for p in paths:
_found, results = self._load_inventory_file(path=p, loader=loader) _found, results = self._load_inventory_file(path=p, loader=loader)
data = self._combine_vars(data, results) if results is not None:
data = self._combine_vars(data, results)
else: else:
file_name, ext = os.path.splitext(path) file_name, ext = os.path.splitext(path)