diff --git a/lib/config/hostgroups.py b/lib/config/hostgroups.py index 929a23f..047bf13 100644 --- a/lib/config/hostgroups.py +++ b/lib/config/hostgroups.py @@ -57,7 +57,7 @@ class HostGroup(object): l.extend(item) else: l.append(item) - + def add_members(self, member): self.__add_internal(self.get_members(), member) @@ -80,11 +80,8 @@ 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 diff --git a/lib/config/layouts.py b/lib/config/layouts.py index c045869..f17d8a7 100644 --- a/lib/config/layouts.py +++ b/lib/config/layouts.py @@ -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 diff --git a/lib/config/parser.py b/lib/config/parser.py index b5fd4d3..e8daf8d 100644 --- a/lib/config/parser.py +++ b/lib/config/parser.py @@ -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 diff --git a/lib/core/job.py b/lib/core/job.py index 8f61e52..2608f2b 100644 --- a/lib/core/job.py +++ b/lib/core/job.py @@ -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(): diff --git a/linspector b/linspector index 76e352b..2e031cc 100755 --- a/linspector +++ b/linspector @@ -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 + ")")