mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-22 17:21:55 +00:00
Rename message keys
This commit is contained in:
parent
f5e7d6016a
commit
35e5b595d1
@ -9,7 +9,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FSMHandler:
|
||||
keys = ['fsm.step', 'fsm.update']
|
||||
keys = ['fsm.step', 'fsm.announce']
|
||||
def __init__(self, *, fsm_type):
|
||||
self.fsm = fsm_type()
|
||||
self._fsm_updater = FSMUpdater(self.fsm)
|
||||
@ -17,7 +17,7 @@ class FSMHandler:
|
||||
|
||||
self.command_handlers = {
|
||||
'fsm.step' : self.handle_step,
|
||||
'fsm.update' : self.handle_update
|
||||
'fsm.announce' : self.handle_announce
|
||||
}
|
||||
|
||||
def handle_event(self, message, connector):
|
||||
@ -34,6 +34,6 @@ class FSMHandler:
|
||||
if self.fsm.step(message['trigger']):
|
||||
return message
|
||||
|
||||
def handle_update(self, message):
|
||||
def handle_announce(self, message):
|
||||
# pylint: disable=no-self-use
|
||||
return message
|
||||
|
@ -5,7 +5,7 @@ class FSMUpdater:
|
||||
@property
|
||||
def fsm_update(self):
|
||||
return {
|
||||
'key': 'fsm.announce',
|
||||
'key': 'fsm.update',
|
||||
**self.fsm_update_data
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ class LogInotifyObserver(InotifyObserver, ProcessLogManager):
|
||||
|
||||
def on_modified(self, event):
|
||||
self._connector.send_message({
|
||||
'key': 'log.new',
|
||||
'key': 'process.log.new',
|
||||
'stdout': self.read_stdout(self.process_name, tail=self.log_tail),
|
||||
'stderr': self.read_stderr(self.process_name, tail=self.log_tail)
|
||||
}, Scope.BROADCAST)
|
||||
|
@ -6,7 +6,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ProcessLogHandler:
|
||||
keys = ['log.set']
|
||||
keys = ['process.log.set']
|
||||
|
||||
def __init__(self, *, process_name, supervisor_uri, log_tail=0):
|
||||
self.connector, self._monitor = None, None
|
||||
@ -15,7 +15,7 @@ class ProcessLogHandler:
|
||||
self._initial_log_tail = log_tail
|
||||
|
||||
self.command_handlers = {
|
||||
'log.set': self.handle_set
|
||||
'process.log.set': self.handle_set
|
||||
}
|
||||
|
||||
def start(self):
|
||||
|
@ -6,11 +6,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FSMAware:
|
||||
keys = ['fsm.announce']
|
||||
"""
|
||||
Base class for stuff that has to be aware of the framework FSM.
|
||||
This is done by processing 'fsm_update' messages.
|
||||
"""
|
||||
keys = ['fsm.update']
|
||||
def __init__(self):
|
||||
self.fsm_state = None
|
||||
self.fsm_in_accepted_state = False
|
||||
@ -18,7 +14,7 @@ class FSMAware:
|
||||
self._auth_key = KeyManager().auth_key
|
||||
|
||||
def process_message(self, message):
|
||||
if message['key'] == 'fsm.announce':
|
||||
if message['key'] == 'fsm.update':
|
||||
if verify_message(self._auth_key, message):
|
||||
self._handle_fsm_update(message)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user