prepared a lot of stuff for new task handling... it was a hell to cleanup unused stuff!!!

This commit is contained in:
Johannes Findeisen 2013-11-08 05:52:47 +01:00
commit 93bee9a8b2
13 changed files with 165 additions and 212 deletions

View file

@ -116,37 +116,4 @@ class HostGroup(object):
return self.name
def get_members(self):
return self.members
class HostGroupService:
def __init__(self, services, periods):
self.services = services
self.periods = periods
def __str__(self):
return "HostgroupService { " + str([str(s) for s in self.services]) + ", " + str([p.name for p in self.periods]) + "}"
def parseHostGroupList(hostgroups, hosts, members, periods, services):
parsedHostGroups = []
for hgname, hgValues in hostgroups.items():
hostGroup = HostGroup(hgname)
hostGroup.members = [m for m in members if m.nameid in hgValues['members']]
hostGroup.hosts = [h for h in hosts if h.name in hgValues['hosts']]
hostGroup.threshold = hgValues['threshold']
if 'parent' in hgValues:
hostGroup.parent = hgValues['parent']
hostGroup.services = []
for serviceName, servicePeriods in hgValues['services'].items():
services = []
for host in hosts:
service = host.getHostServiceByName(serviceName)
if service is not None:
services.append(service)
else:
logger.warning("could not find HostService(" + str(serviceName) + ") for host " + host.name)
hostGroupPeriods = [p for p in periods if p.name in servicePeriods]
hostGroup.services.append(HostGroupService(services, hostGroupPeriods))
parsedHostGroups.append(hostGroup)
return parsedHostGroups
return self.members