mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-18 22:31:06 -07:00
Make sure any existing groups gets reused
This commit is contained in:
parent
5504f13c68
commit
0c70abfaa9
2 changed files with 4 additions and 3 deletions
|
@ -67,9 +67,10 @@ class InventoryParser(object):
|
|||
active_group_name = line.replace("[","").replace("]","").strip()
|
||||
if line.find(":vars") != -1 or line.find(":children") != -1:
|
||||
active_group_name = active_group_name.rsplit(":", 1)[0]
|
||||
self.groups[active_group_name] = Group(name=active_group_name)
|
||||
if active_group_name not in self.groups:
|
||||
self.groups[active_group_name] = Group(name=active_group_name)
|
||||
active_group_name = None
|
||||
else:
|
||||
elif active_group_name not in self.groups:
|
||||
new_group = self.groups[active_group_name] = Group(name=active_group_name)
|
||||
all.add_child_group(new_group)
|
||||
elif line.startswith("#") or line == '':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue