[WIP] work on history writer
Change-Id: If8c42091c734fb8c7b386c06429f1b21a7e169ec
This commit is contained in:
@ -35,7 +35,6 @@ from collections import OrderedDict
|
||||
from secop.errors import ConfigError, SECoPError
|
||||
from secop.lib import formatException, get_class, getGeneralConfig
|
||||
from secop.modules import Attached
|
||||
from secop.params import PREDEFINED_ACCESSIBLES
|
||||
|
||||
try:
|
||||
from daemon import DaemonContext
|
||||
@ -207,7 +206,11 @@ class Server:
|
||||
self.log.info('startup done, handling transport messages')
|
||||
if systemd:
|
||||
systemd.daemon.notify("READY=1\nSTATUS=accepting requests")
|
||||
self.interface.serve_forever()
|
||||
try:
|
||||
self.interface.serve_forever()
|
||||
except KeyboardInterrupt as e:
|
||||
self._restart = False
|
||||
self.dispatcher.close()
|
||||
self.interface.server_close()
|
||||
if self._restart:
|
||||
self.restart_hook()
|
||||
@ -329,11 +332,8 @@ class Server:
|
||||
self.log.info('all modules and pollers started')
|
||||
history_path = os.environ.get('FRAPPY_HISTORY')
|
||||
if history_path:
|
||||
from secop_psi.historywriter import FrappyHistoryWriter # pylint: disable=import-outside-toplevel
|
||||
writer = FrappyHistoryWriter(history_path, PREDEFINED_ACCESSIBLES.keys(), self.dispatcher)
|
||||
# treat writer as a connection
|
||||
self.dispatcher.add_connection(writer)
|
||||
writer.init(self.dispatcher.handle_describe(writer, None, None))
|
||||
from secop_psi.historywriter import add_writer # pylint: disable=import-outside-toplevel
|
||||
add_writer(history_path, self)
|
||||
# TODO: if ever somebody wants to implement an other history writer:
|
||||
# - a general config file /etc/secp/secop.conf or <frappy repo>/etc/secop.conf
|
||||
# might be introduced, which contains the log, pid and cfg directory path and
|
||||
|
Reference in New Issue
Block a user