1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-12-05 02:31:33 +00:00

Separate event handlers from independent components

This commit is contained in:
R. Richard 2019-06-20 16:06:23 +02:00
parent 096bba8367
commit dc42e0f4d0
3 changed files with 11 additions and 10 deletions

View File

@ -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

View File

@ -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".'

View File

@ -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,