Create entry for empty groups in inventory_rolemap
When a group is a child of another group then the child groups role mappings are added to the parent group role mappings. This which fails with a KeyError when the child is an empty group as no mapping is created. Closes-bug: #1994081 Related: rhbz#2089512 Change-Id: I05f4989b0f14d56d3c33f91b3cccb85b729987cb
This commit is contained in:
parent
1a704df060
commit
2eea005773
|
@ -49,7 +49,7 @@ def to_inventory_hostmap(data):
|
|||
|
||||
|
||||
def to_inventory_rolemap(data):
|
||||
# Falttens inventory to a group->role mapping
|
||||
# Flattens inventory to a group->role mapping
|
||||
if isinstance(data, str):
|
||||
inventory = yaml.safe_load(data)
|
||||
else:
|
||||
|
@ -65,6 +65,7 @@ def to_inventory_rolemap(data):
|
|||
inventory[group]['vars']['tripleo_role_name']
|
||||
]
|
||||
else:
|
||||
group_role_map[group] = []
|
||||
if 'children' in inventory[group]:
|
||||
for child in inventory[group]['children']:
|
||||
# Children have not all been flattened yet
|
||||
|
@ -73,7 +74,6 @@ def to_inventory_rolemap(data):
|
|||
todo.append(group)
|
||||
break
|
||||
else:
|
||||
group_role_map[group] = []
|
||||
for child in inventory[group]['children']:
|
||||
group_role_map[group] += group_role_map[child]
|
||||
group_role_map[group].sort()
|
||||
|
|
Loading…
Reference in New Issue