removed parsers and processors from parser.py
This commit is contained in:
parent
fd67000547
commit
8cb4358ba8
1 changed files with 2 additions and 14 deletions
|
|
@ -30,13 +30,9 @@ from config import LinspectorConfig
|
||||||
from periods import CronPeriod, DatePeriod, IntervalPeriod
|
from periods import CronPeriod, DatePeriod, IntervalPeriod
|
||||||
|
|
||||||
from linspector.services.service import Service
|
from linspector.services.service import Service
|
||||||
from linspector.processors.processor import Processor
|
|
||||||
from linspector.parsers.parser import Parser
|
|
||||||
from linspector.tasks.task import TaskList
|
from linspector.tasks.task import TaskList
|
||||||
|
|
||||||
MOD_SERVICES = "services"
|
MOD_SERVICES = "services"
|
||||||
MOD_PROCESSORS = "processors"
|
|
||||||
MOD_PARSERS = "parsers"
|
|
||||||
MOD_TASKS = "tasks"
|
MOD_TASKS = "tasks"
|
||||||
|
|
||||||
KEY_LAYOUTS = "layouts"
|
KEY_LAYOUTS = "layouts"
|
||||||
|
|
@ -67,7 +63,7 @@ class ConfigParser:
|
||||||
self.members = {}
|
self.members = {}
|
||||||
self.periods = {}
|
self.periods = {}
|
||||||
self.layouts = {}
|
self.layouts = {}
|
||||||
self._loadedMods = {MOD_SERVICES: {}, MOD_PROCESSORS: {}, MOD_TASKS: {}, MOD_PARSERS: {}}
|
self._loadedMods = {MOD_SERVICES: {}, MOD_TASKS: {}}
|
||||||
|
|
||||||
def _create_new_config_dict(self):
|
def _create_new_config_dict(self):
|
||||||
return {"members": {}, "periods": {}, "hostgroups": {}, "layouts": {}, "core": {}, "tasks": {}}
|
return {"members": {}, "periods": {}, "hostgroups": {}, "layouts": {}, "core": {}, "tasks": {}}
|
||||||
|
|
@ -225,7 +221,7 @@ class FullConfigParser(ConfigParser):
|
||||||
parses the full config
|
parses the full config
|
||||||
Parsing will be done in 3 steps:
|
Parsing will be done in 3 steps:
|
||||||
1. get raw Config Objects by just passing the values defined inside the config
|
1. get raw Config Objects by just passing the values defined inside the config
|
||||||
2. replace references by objects, import services, tasks, parsers and processors
|
2. replace references by objects, import services and tasks
|
||||||
3. do sanity checks
|
3. do sanity checks
|
||||||
|
|
||||||
:param configFilename: the configuration file to parse
|
:param configFilename: the configuration file to parse
|
||||||
|
|
@ -257,18 +253,10 @@ class FullConfigParser(ConfigParser):
|
||||||
class_check = lambda service: isinstance(service, Service)
|
class_check = lambda service: isinstance(service, Service)
|
||||||
self.replace_with_import(self.hostgroups, MOD_SERVICES, items_func, class_check)
|
self.replace_with_import(self.hostgroups, MOD_SERVICES, items_func, class_check)
|
||||||
|
|
||||||
items_func = lambda hostgroup: hostgroup.get_processors()
|
|
||||||
class_check = lambda processor: isinstance(processor, Processor)
|
|
||||||
self.replace_with_import(self.hostgroups, MOD_PROCESSORS, items_func, class_check)
|
|
||||||
|
|
||||||
services = []
|
services = []
|
||||||
for hg in self.hostgroups:
|
for hg in self.hostgroups:
|
||||||
services.extend(hg.get_services())
|
services.extend(hg.get_services())
|
||||||
|
|
||||||
items_func = lambda service: service.get_parser()
|
|
||||||
class_check = lambda parser: isinstance(parser, Parser)
|
|
||||||
self.replace_with_import(services, MOD_PARSERS, items_func, class_check)
|
|
||||||
|
|
||||||
#replace object pointer
|
#replace object pointer
|
||||||
id_list_func = lambda hostgroup: hostgroup.get_members()
|
id_list_func = lambda hostgroup: hostgroup.get_members()
|
||||||
id_get_func = lambda member: member.get_id()
|
id_get_func = lambda member: member.get_id()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue