too bad, long nights, all good (nearly)

This commit is contained in:
Rafael.Timmerberg 2013-06-21 01:46:08 +02:00
commit b4173f0d6e
5 changed files with 8 additions and 30 deletions

View file

@ -80,10 +80,7 @@ class HostGroup(object):
return self.processors
def get_services(self):
s = self.__services
if not isinstance(s, list):
s = self.__dict__["_HostGroup__services"]
return s
return self.__services
def get_hosts(self):
return self.hosts

View file

@ -6,7 +6,7 @@ class LayoutException(Exception):
return repr(self.msg)
class Layout:
class Layout(object):
def __init__(self, name, enabled=False, hostgroups=None):
self._name = name
self._enabled = enabled

View file

@ -10,7 +10,6 @@ from members import Member
from periods import CronPeriod, DatePeriod, IntervalPeriod
from lib.services.service import Service
#print id(Service)
from lib.processors.processor import Processor
from lib.parsers.parser import Parser
from lib.tasks.task import Task

View file

@ -3,7 +3,7 @@ This is what job_function needs as parameter for each job to successfully
execute.
"""
from command import Command
from lib.core.command import Command
def generateId():

View file

@ -62,29 +62,11 @@ def main():
jobs = []
for layout in layouts:
#for i in range(len(layout._hostgroups)):
# for y in range(len(layout._hostgroups[i])._services):
# for period in layout.get_hostgroups()[i]._services[y]:
# log.i("wtf")
# for serv in layout.get_hostgroups()[i].get_services():
# for service in serv:
# for period in service.get_periods():
# pass
if layout.is_enabled():
for hostgroup in layout.get_hostgroups():
for sr in hostgroup.get_services():
if not isinstance(sr, list):
log.i("check from hostgroup: id(" + str(id(hostgroup)) + ") " + str(hostgroup))
log.i("check from sr.get_hostgroup(): id(" + str(id(sr.get_hostgroup)) + ") " + str(sr.get_hostgroup()))
sr = hostgroup.__dict__["_HostGroup__services"]
if not isinstance(sr, list):
sr = sr.get_hostgroup().get_services()
for s in sr:
for period in s.get_periods():
jobs.append(period.createJob(scheduler, s, handleJob))
for service in hostgroup.s:
for period in service.get_periods():
jobs.append(period.createJob(scheduler, service, handleJob))
scheduler.start()
#log.i("starting linspector: reading config... (" + args.config + ")")