From 9c8f0da32754cc4377f3fb58b496241a38bf8344 Mon Sep 17 00:00:00 2001 From: Serge van Ginderachter Date: Tue, 14 Jul 2015 00:14:13 +0200 Subject: [PATCH] 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. --- lib/ansible/vars/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index 13c9cc8f08b..96313ef4f43 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -308,7 +308,8 @@ class VariableManager: paths = [os.path.join(path, name) for name in names if not name.startswith('.')] for p in paths: _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: file_name, ext = os.path.splitext(path)