allow for null values in yaml inventory (#26765)

* allow for null values in yaml inventory

* 3 dad3 dad3 dad3 dad3 dad3 dad3 dad3 dad
pull/27152/head
Brian Coca 7 years ago committed by GitHub
parent 5c6e5d4841
commit aca11a28a2

@ -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)

Loading…
Cancel
Save