cleaned linspector ,refactored command-line parsing, and fixed the Logger

This commit is contained in:
Rafael.Timmerberg 2013-05-24 02:50:10 +02:00
commit 5b09f02d68
8 changed files with 445 additions and 213 deletions

View file

@ -35,7 +35,7 @@ class HostGroupService:
return "HostgroupService { " + str(self.service) + ", " + str(self.periods) + "}"
def parseHostGroupList(hostgroups, hosts, members, periods, services):
def parseHostGroupList(hostgroups, hosts, members, periods, services, log):
parsedHostGroups = []
for hgname, hgValues in hostgroups.items():
hostGroup = HostGroup(hgname)
@ -47,8 +47,8 @@ def parseHostGroupList(hostgroups, hosts, members, periods, services):
hostGroup.services = []
for serviceName, servicePeriods in hgValues['services'].items():
service = filter(lambda s: s.name in serviceName, services)
if not service:
print "warning: Service " + serviceName + " is not defined for Hostgroup " + hgname
if len(service) == 0:
log.w("Service " + serviceName + " is not defined for Hostgroup " + hgname)
continue
service = service[0]
hostGroupPeriods = filter(lambda p: p.name in servicePeriods, periods)