diff options
-rw-r--r-- | tests/unit/test_inventory.py | 6 | ||||
-rw-r--r-- | zuul/executor/server.py | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/tests/unit/test_inventory.py b/tests/unit/test_inventory.py index b7e35ebd2..30fa10c4d 100644 --- a/tests/unit/test_inventory.py +++ b/tests/unit/test_inventory.py @@ -89,14 +89,16 @@ class TestInventory(ZuulTestCase): all_nodes = ('controller', 'compute1', 'compute2') self.assertIn('all', inventory) + self.assertIn('children', inventory['all']) self.assertIn('hosts', inventory['all']) self.assertIn('vars', inventory['all']) for group_name in ('ceph-osd', 'ceph-monitor'): - self.assertIn(group_name, inventory) + self.assertIn(group_name, inventory['all']['children']) for node_name in all_nodes: self.assertIn(node_name, inventory['all']['hosts']) self.assertIn(node_name, - inventory['ceph-monitor']['hosts']) + inventory['all']['children'] + ['ceph-monitor']['hosts']) self.assertIn('zuul', inventory['all']['vars']) z_vars = inventory['all']['vars']['zuul'] self.assertIn('executor', z_vars) diff --git a/zuul/executor/server.py b/zuul/executor/server.py index 46b161ce0..dd8151ee7 100644 --- a/zuul/executor/server.py +++ b/zuul/executor/server.py @@ -565,15 +565,19 @@ def make_inventory_dict(nodes, args, all_vars): } for group in args['groups']: + if 'children' not in inventory['all']: + inventory['all']['children'] = dict() group_hosts = {} for node_name in group['nodes']: group_hosts[node_name] = None group_vars = args['group_vars'].get(group['name'], {}).copy() check_varnames(group_vars) - inventory[group['name']] = { - 'hosts': group_hosts, - 'vars': group_vars, - } + + inventory['all']['children'].update({ + group['name']: { + 'hosts': group_hosts, + 'vars': group_vars, + }}) return inventory |