From dc42e0f4d00d2ac9a7a137b687c8e80b20eb8a3a Mon Sep 17 00:00:00 2001 From: "R. Richard" Date: Thu, 20 Jun 2019 16:06:23 +0200 Subject: [PATCH] Separate event handlers from independent components --- solvable/src/event_handler_main.py | 10 +++++----- solvable/src/pipe_io_auxlib.py | 9 +++++---- solvable/src/pipe_io_main.py | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/solvable/src/event_handler_main.py b/solvable/src/event_handler_main.py index 16bdd81..94843c9 100644 --- a/solvable/src/event_handler_main.py +++ b/solvable/src/event_handler_main.py @@ -7,11 +7,11 @@ from tornado.ioloop import IOLoop from tfw.fsm import YamlFSM from tfw.event_handlers import EventHandlerBase, FSMAwareEventHandler, TFWServerUplinkConnector -from tfw.components import IdeEventHandler, TerminalEventHandler -from tfw.components import ProcessManagingEventHandler, BashMonitor -from tfw.components import TerminalCommands, LogMonitoringEventHandler -from tfw.components import FSMManagingEventHandler, DirectorySnapshottingEventHandler -from tfw.components import FrontendEventHandler, MessageSender +from tfw.builtins import FrontendEventHandler +from tfw.builtins import IdeEventHandler, TerminalEventHandler +from tfw.builtins import LogMonitoringEventHandler, ProcessManagingEventHandler +from tfw.builtins import DirectorySnapshottingEventHandler, FSMManagingEventHandler +from tfw.components import BashMonitor, MessageSender, TerminalCommands from tfw.config import TFWENV from tao.config import TAOENV from tfw.config.log import TFWLog diff --git a/solvable/src/pipe_io_auxlib.py b/solvable/src/pipe_io_auxlib.py index 9b85fde..d866fe0 100644 --- a/solvable/src/pipe_io_auxlib.py +++ b/solvable/src/pipe_io_auxlib.py @@ -1,8 +1,9 @@ from json import dumps, loads from tfw.crypto import KeyManager, sign_message, verify_message -from tfw.components import PipeIOEventHandlerBase -from tfw.components.pipe_io_event_handler import DEFAULT_PERMISSIONS +from tfw.builtins import PipeIOEventHandlerBase +from tfw.builtins.pipe_io_event_handler import DEFAULT_PERMISSIONS +from tfw.networking.scope import Scope class SignMessagePipeIOEventHandler(PipeIOEventHandlerBase): @@ -137,9 +138,9 @@ class DeployPipeIOEventHandler(PipeIOEventHandlerBase): self.expected = False if message_bytes == b'true': - self.server_connector.send_message(self.onsuccess) + self.server_connector.send_message(self.onsuccess, scope=Scope.WEBSOCKET) elif message_bytes == b'false': - self.server_connector.send_message(self.onerror) + self.server_connector.send_message(self.onerror, scope=Scope.WEBSOCKET) else: raise ValueError( f'{self.pipe_io.in_pipe}: Expected "true" or "false".' diff --git a/solvable/src/pipe_io_main.py b/solvable/src/pipe_io_main.py index a1e9e9a..b446820 100644 --- a/solvable/src/pipe_io_main.py +++ b/solvable/src/pipe_io_main.py @@ -4,7 +4,7 @@ from signal import signal, SIGTERM, SIGINT from tornado.ioloop import IOLoop from tfw.event_handlers import EventHandlerBase -from tfw.components import PipeIOEventHandler +from tfw.builtins import PipeIOEventHandler from pipe_io_auxlib import ( SignMessagePipeIOEventHandler, VerifyMessagePipeIOEventHandler,