From 23a852bdab03ea85aa335b9c95c1515dd802ac73 Mon Sep 17 00:00:00 2001 From: Nikhil Jain Date: Fri, 30 Oct 2020 14:23:57 +0530 Subject: [PATCH] add the empty child group to groups before adding it to the parent group --- awx_collection/plugins/inventory/tower.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/awx_collection/plugins/inventory/tower.py b/awx_collection/plugins/inventory/tower.py index 7dc4aaa1a3..5be3af2756 100644 --- a/awx_collection/plugins/inventory/tower.py +++ b/awx_collection/plugins/inventory/tower.py @@ -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':