housekeeping and cleanups...

This commit is contained in:
Johannes Findeisen 2013-05-30 04:20:35 +02:00
commit 88b0c3dd7a
5 changed files with 23 additions and 33 deletions

View file

@ -52,7 +52,7 @@ def parseHostGroupList(hostgroups, hosts, members, periods, services, log):
if service is not None:
services.append(service)
else:
log.w("could not find HostService(" +str(serviceName) + ") for host " + host.name)
log.w("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)

View file

@ -45,12 +45,12 @@ class HostService:
ret += "warning: " + str(self.warning)
if self.critical:
ret += "critical: " + str(self.critical)
return ret;
return ret
def parseHostList(hosts, services, log):
"""
parse the HostList and replace any command as nessesary
parse the HostList and replace any command as necessary
"""
#precompiled regexPattern which finds replacements in service strings
pattern = re.compile("@(\w+)")
@ -97,7 +97,7 @@ def parseHostList(hosts, services, log):
#host will not be inside ServiceParameters, so check this also
if 'host' in replacements:
log.d("replacing host in " + hostService.getCommand())
comm= re.sub('@host', host.host, hostService.getCommand())
comm = re.sub('@host', host.host, hostService.getCommand())
hostService.setCommand(comm)
log.d("new Command: " +comm)
log.d("set in hostService: " + str(hostService))