From 2388a945a4a8cd02cb4be435f6c115bcdf80e716 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Tue, 1 Oct 2013 06:17:08 +0200 Subject: [PATCH] moved some frontends/* to new backends/; backends are threads running in background, no frontend --- lib/{frontends => backends}/https.py | 6 +++--- lib/{frontends => backends}/xmpp.py | 4 ++-- lib/frontends/frontend.py | 7 +++---- linspector | 8 ++++++++ 4 files changed, 16 insertions(+), 9 deletions(-) rename lib/{frontends => backends}/https.py (61%) rename lib/{frontends => backends}/xmpp.py (79%) diff --git a/lib/frontends/https.py b/lib/backends/https.py similarity index 61% rename from lib/frontends/https.py rename to lib/backends/https.py index 70a63dd..89811ad 100644 --- a/lib/frontends/https.py +++ b/lib/backends/https.py @@ -1,13 +1,13 @@ """ -A HTTPS frontend to the current Linspector instance. +A HTTPS backend to the current Linspector instance. A Webserver listening for requests to give information about the internal state of linspector. (maybe providing a JSON API to the instance too...) """ -from lib.frontends.frontend import Frontend +from lib.backends.backend import Backend -class HttpsFrontend(Frontend): +class HttpsBackend(Backend): def __init__(self, **kwargs): return \ No newline at end of file diff --git a/lib/frontends/xmpp.py b/lib/backends/xmpp.py similarity index 79% rename from lib/frontends/xmpp.py rename to lib/backends/xmpp.py index 6b84397..c1d25dc 100644 --- a/lib/frontends/xmpp.py +++ b/lib/backends/xmpp.py @@ -5,9 +5,9 @@ Just for the fun in it... Linspector connects to a XMPP Server and are accepting give back information. The Linspector admin client will then be any Jabber Client... ;) """ -from lib.frontends.frontend import Frontend +from lib.backends.backend import Backend -class XmmpFrontend(Frontend): +class XmmpBackend(Backend): def __init__(self, **kwargs): pass \ No newline at end of file diff --git a/lib/frontends/frontend.py b/lib/frontends/frontend.py index f953f25..91ff5b3 100644 --- a/lib/frontends/frontend.py +++ b/lib/frontends/frontend.py @@ -1,9 +1,8 @@ """ -Just the frontends.py stub... ;) +Frontends are GUI interfaces to Linspector. This could be a shell or other terminal based GUI. -If linspector is being started without a frontend "enabled" it just is doing stuff like: polling, alerting, logging etc. - -Frontends are absolutely no requirement for running Linspector. +Frontends are absolutely no requirement for running Linspector. If no frontend is selected Linspector will just log +stuff to stdout. """ diff --git a/linspector b/linspector index bbe46d9..458bc0f 100755 --- a/linspector +++ b/linspector @@ -11,6 +11,7 @@ import os.path as path from apscheduler.scheduler import Scheduler from lib.config.parser import FullConfigParser from lib.core.job import Job +from lib.backends.https import HttpsBackend from lib.frontends.lish import LishFrontend @@ -98,6 +99,13 @@ def main(): job.set_logger(log) jobs.append(job) + #TODO: Load Backend Threads here before initializing the frontend. + ''' + for backend in backends.enabled + backend.start + + take care of signals etc. to sthutdown the threads when stopping linspector. + ''' frontend = LishFrontend(jobs=jobs, scheduler=scheduler, linspectorConfig=linConf) log.debug("shutting down scheduler")