From aca11a28a20197ef1202ff02c56061ca181892cd Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 20 Jul 2017 20:28:09 -0400 Subject: [PATCH] allow for null values in yaml inventory (#26765) * allow for null values in yaml inventory * 3 dad3 dad3 dad3 dad3 dad3 dad3 dad3 dad --- lib/ansible/plugins/inventory/yaml.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/plugins/inventory/yaml.py b/lib/ansible/plugins/inventory/yaml.py index 3934c2167f3..520d8543a3f 100644 --- a/lib/ansible/plugins/inventory/yaml.py +++ b/lib/ansible/plugins/inventory/yaml.py @@ -126,16 +126,16 @@ class InventoryModule(BaseFileInventoryPlugin): if section in group_data and isinstance(group_data[section], string_types): group_data[section] = {group_data[section]: None} - if 'vars' in group_data: + if group_data.get('vars', False): for var in group_data['vars']: self.inventory.set_variable(group, var, group_data['vars'][var]) - if 'children' in group_data: + if group_data.get('children', False): for subgroup in group_data['children']: self._parse_group(subgroup, group_data['children'][subgroup]) self.inventory.add_child(group, subgroup) - if 'hosts' in group_data: + if group_data.get('hosts', False): for host_pattern in group_data['hosts']: hosts, port = self._parse_host(host_pattern) self.populate_host_vars(hosts, group_data['hosts'][host_pattern] or {}, group, port)