added pointer for hostgroup in service
This commit is contained in:
parent
d66ed9413d
commit
88e63fbfe1
4 changed files with 15 additions and 1 deletions
|
|
@ -251,4 +251,8 @@ class FullConfigParser(ConfigParser):
|
||||||
id_get_func = lambda hostgroup: hostgroup.get_name()
|
id_get_func = lambda hostgroup: hostgroup.get_name()
|
||||||
self.replace_pointer(layouts, hostgroups, id_list_func, id_get_func)
|
self.replace_pointer(layouts, hostgroups, id_list_func, id_get_func)
|
||||||
|
|
||||||
|
for hg in hostgroups:
|
||||||
|
for service in hg.get_services():
|
||||||
|
service.set_hostgroup(hg)
|
||||||
|
|
||||||
return layouts
|
return layouts
|
||||||
|
|
@ -4,6 +4,10 @@ class Service:
|
||||||
self.command = command
|
self.command = command
|
||||||
self.comment = comment
|
self.comment = comment
|
||||||
self.parser = parser
|
self.parser = parser
|
||||||
|
self.hostgroup = None
|
||||||
|
|
||||||
|
def set_hostgroup(self, hostgroup):
|
||||||
|
self.hostgroup = hostgroup
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Service('Name: " + self.name + "', 'Command: " + self.command + ", 'Parser: " + self.parser + "')"
|
return "Service('Name: " + self.name + "', 'Command: " + self.command + ", 'Parser: " + self.parser + "')"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from lib.services.service import Service
|
||||||
|
|
||||||
class PingService(Service):
|
class PingService(Service):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
Service.__init__(self, **kwargs)
|
super(PingService, self).__init__(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
def create(kwargs):
|
def create(kwargs):
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,12 @@ class Service(object):
|
||||||
else:
|
else:
|
||||||
self._periods.append(period)
|
self._periods.append(period)
|
||||||
|
|
||||||
|
def set_hostgroup(self, hostgroup):
|
||||||
|
self.hostgroup = hostgroup
|
||||||
|
|
||||||
|
def get_hostgroup(self):
|
||||||
|
return self.hostgroup
|
||||||
|
|
||||||
def get_periods(self):
|
def get_periods(self):
|
||||||
return self._periods
|
return self._periods
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue