|
|
|
|
@ -40,8 +40,13 @@ class Group(object):
|
|
|
|
|
# don't add if it's already there
|
|
|
|
|
if not group in self.child_groups:
|
|
|
|
|
self.child_groups.append(group)
|
|
|
|
|
|
|
|
|
|
# update the depth of the child
|
|
|
|
|
group.depth = max([self.depth+1, group.depth])
|
|
|
|
|
|
|
|
|
|
# update the depth of the grandchildren
|
|
|
|
|
group._check_children_depth()
|
|
|
|
|
|
|
|
|
|
# now add self to child's parent_groups list, but only if there
|
|
|
|
|
# isn't already a group with the same name
|
|
|
|
|
if not self.name in [g.name for g in group.parent_groups]:
|
|
|
|
|
@ -49,6 +54,12 @@ class Group(object):
|
|
|
|
|
|
|
|
|
|
self.clear_hosts_cache()
|
|
|
|
|
|
|
|
|
|
def _check_children_depth(self):
|
|
|
|
|
|
|
|
|
|
for group in self.child_groups:
|
|
|
|
|
group.depth = max([self.depth+1, group.depth])
|
|
|
|
|
group._check_children_depth()
|
|
|
|
|
|
|
|
|
|
def add_host(self, host):
|
|
|
|
|
|
|
|
|
|
self.hosts.append(host)
|
|
|
|
|
|