When a group only has children and no hosts/vars, still return things in hash-mode, because

Ansible is not smart enough to know that 'just children' in hash mode means anything.
This commit is contained in:
Michael DeHaan
2013-07-27 17:36:02 -04:00
parent ceea3cd238
commit ac3ab82cc6
2 changed files with 15 additions and 6 deletions

View File

@@ -564,8 +564,14 @@ class InventoryScriptView(RetrieveAPIView):
'children': list(children.values_list('name', flat=True)),
'vars': group.variables_dict,
}
group_info = dict(filter(lambda x: bool(x[1]),
group_info.items()))
# this confuses the inventory script if the group
# has children set and no variables or hosts.
# no other reason to do this right?
#
# group_info = dict(filter(lambda x: bool(x[1]),
# group_info.items()))
if group_info.keys() in ([], ['hosts']):
data[group.name] = group_info.get('hosts', [])
else: