|
|
@ -18,10 +18,11 @@
|
|
|
|
class Group(object):
|
|
|
|
class Group(object):
|
|
|
|
''' a group of ansible hosts '''
|
|
|
|
''' a group of ansible hosts '''
|
|
|
|
|
|
|
|
|
|
|
|
__slots__ = [ 'name', 'hosts', 'vars', 'child_groups', 'parent_groups' ]
|
|
|
|
__slots__ = [ 'name', 'hosts', 'vars', 'child_groups', 'parent_groups', 'depth' ]
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, name=None):
|
|
|
|
def __init__(self, name=None):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.depth = 0
|
|
|
|
self.name = name
|
|
|
|
self.name = name
|
|
|
|
self.hosts = []
|
|
|
|
self.hosts = []
|
|
|
|
self.vars = {}
|
|
|
|
self.vars = {}
|
|
|
@ -35,6 +36,7 @@ class Group(object):
|
|
|
|
if self == group:
|
|
|
|
if self == group:
|
|
|
|
raise Exception("can't add group to itself")
|
|
|
|
raise Exception("can't add group to itself")
|
|
|
|
self.child_groups.append(group)
|
|
|
|
self.child_groups.append(group)
|
|
|
|
|
|
|
|
group.depth = group.depth + 1
|
|
|
|
group.parent_groups.append(self)
|
|
|
|
group.parent_groups.append(self)
|
|
|
|
|
|
|
|
|
|
|
|
def add_host(self, host):
|
|
|
|
def add_host(self, host):
|
|
|
|