some exception handling for logfile parsing; exit program when this raises an exception
This commit is contained in:
parent
f9917614c9
commit
56eb1b74ae
1 changed files with 9 additions and 4 deletions
|
|
@ -88,8 +88,13 @@ def main():
|
||||||
root_logger.addHandler(handler)
|
root_logger.addHandler(handler)
|
||||||
root_logger.setLevel(args.loglevel)
|
root_logger.setLevel(args.loglevel)
|
||||||
|
|
||||||
configParser = FullConfigParser()
|
try:
|
||||||
linConf, core = configParser.parse_config(args.config)
|
config_parser = FullConfigParser()
|
||||||
|
linspector_configuration, core = config_parser.parse_config(args.config)
|
||||||
|
except Exception, msg:
|
||||||
|
print("Configuration error: " + str(msg) + "; Exiting now.")
|
||||||
|
logger.error(msg)
|
||||||
|
exit()
|
||||||
|
|
||||||
scheduler = Scheduler({"apscheduler.threadpool.max_threads": 1000})
|
scheduler = Scheduler({"apscheduler.threadpool.max_threads": 1000})
|
||||||
scheduler.start()
|
scheduler.start()
|
||||||
|
|
@ -97,7 +102,7 @@ def main():
|
||||||
start_date = datetime.datetime.now()
|
start_date = datetime.datetime.now()
|
||||||
time_delta = 0
|
time_delta = 0
|
||||||
jobs = []
|
jobs = []
|
||||||
for layout in linConf.get_enabled_layouts():
|
for layout in linspector_configuration.get_enabled_layouts():
|
||||||
for hostgroup in layout.get_hostgroups():
|
for hostgroup in layout.get_hostgroups():
|
||||||
for service in hostgroup.get_services():
|
for service in hostgroup.get_services():
|
||||||
for host in hostgroup.get_hosts():
|
for host in hostgroup.get_hosts():
|
||||||
|
|
@ -115,7 +120,7 @@ def main():
|
||||||
job.set_job(schedulerJob)
|
job.set_job(schedulerJob)
|
||||||
jobs.append(job)
|
jobs.append(job)
|
||||||
|
|
||||||
interface = LinspectorInterface(jobs, scheduler, linConf)
|
interface = LinspectorInterface(jobs, scheduler, linspector_configuration)
|
||||||
|
|
||||||
if "jsonrpc_backend" in core and core["jsonrpc_backend"]:
|
if "jsonrpc_backend" in core and core["jsonrpc_backend"]:
|
||||||
jsonrpc = JsonrpcBackend(interface, core)
|
jsonrpc = JsonrpcBackend(interface, core)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue