1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

optimization when adding child groups

This commit is contained in:
Serge van Ginderachter 2013-06-03 22:35:07 +02:00
parent 3629867210
commit f1cf81b086

View file

@ -35,9 +35,12 @@ class Group(object):
if self == group:
raise Exception("can't add group to itself")
self.child_groups.append(group)
group.depth = max([self.depth+1, group.depth])
group.parent_groups.append(self)
# don't add if it's already there
if not group in self.child_groups:
self.child_groups.append(group)
group.depth = max([self.depth+1, group.depth])
group.parent_groups.append(self)
def add_host(self, host):