mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-23 01:41:31 +00:00
Update SupervisorMixin users to support stateless API
This commit is contained in:
parent
789db7416d
commit
a6bbe6df55
@ -12,8 +12,8 @@ class ProcessManager(SupervisorMixin):
|
|||||||
'stop': self.stop_process,
|
'stop': self.stop_process,
|
||||||
'restart': self.restart_process}
|
'restart': self.restart_process}
|
||||||
|
|
||||||
def __call__(self, command):
|
def __call__(self, command, process_name):
|
||||||
self.commands[command]()
|
self.commands[command](process_name)
|
||||||
|
|
||||||
|
|
||||||
class ProcessManagingEventHandler(TriggerlessEventHandler):
|
class ProcessManagingEventHandler(TriggerlessEventHandler):
|
||||||
@ -24,5 +24,7 @@ class ProcessManagingEventHandler(TriggerlessEventHandler):
|
|||||||
self.uplink = ServerUplinkConnector()
|
self.uplink = ServerUplinkConnector()
|
||||||
|
|
||||||
def handle_event(self, key, data_json):
|
def handle_event(self, key, data_json):
|
||||||
self.processmanager(data_json['data']['command'])
|
data = data_json['data']
|
||||||
self.uplink.send(self.key, {'key': self.key})
|
self.processmanager(data['command'], data['process_name'])
|
||||||
|
self.uplink.send(self.key, {'key': self.key,
|
||||||
|
'data': {'process_name': data['process_name']}})
|
||||||
|
@ -10,7 +10,7 @@ class TerminadoEventHandler(TriggerlessEventHandler, SupervisorMixin):
|
|||||||
super().__init__(key)
|
super().__init__(key)
|
||||||
self.working_directory = tfwenv.TERMINADO_DIR
|
self.working_directory = tfwenv.TERMINADO_DIR
|
||||||
self.process_name = process_name
|
self.process_name = process_name
|
||||||
self.start_process()
|
self.start_process(self.process_name)
|
||||||
|
|
||||||
def handle_event(self, key, data_json):
|
def handle_event(self, key, data_json):
|
||||||
log.debug('TerminadoEventHandler received event for key {}'.format(key))
|
log.debug('TerminadoEventHandler received event for key {}'.format(key))
|
||||||
|
Loading…
Reference in New Issue
Block a user