Merge pull request #8496 from jainnikhil30/fix_tower_inventory_empty__child_group

Add empty child group to inventory groups before adding it to the parent group

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-10-30 21:02:11 +00:00 committed by GitHub
commit 52ffcc9f7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,6 +153,8 @@ class InventoryModule(BaseInventoryPlugin):
self.inventory.add_host(host_name, group_name)
# Then add the parent-children group relationships.
for child_group_name in group_content.get('children', []):
# add the child group to groups, if its already there it will just throw a warning
self.inventory.add_group(child_group_name)
self.inventory.add_child(group_name, child_group_name)
# Set the group vars. Note we should set group var for 'all', but not '_meta'.
if group_name != '_meta':