mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 21:21:32 +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,
|
||||
'restart': self.restart_process}
|
||||
|
||||
def __call__(self, command):
|
||||
self.commands[command]()
|
||||
def __call__(self, command, process_name):
|
||||
self.commands[command](process_name)
|
||||
|
||||
|
||||
class ProcessManagingEventHandler(TriggerlessEventHandler):
|
||||
@ -24,5 +24,7 @@ class ProcessManagingEventHandler(TriggerlessEventHandler):
|
||||
self.uplink = ServerUplinkConnector()
|
||||
|
||||
def handle_event(self, key, data_json):
|
||||
self.processmanager(data_json['data']['command'])
|
||||
self.uplink.send(self.key, {'key': self.key})
|
||||
data = data_json['data']
|
||||
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)
|
||||
self.working_directory = tfwenv.TERMINADO_DIR
|
||||
self.process_name = process_name
|
||||
self.start_process()
|
||||
self.start_process(self.process_name)
|
||||
|
||||
def handle_event(self, key, data_json):
|
||||
log.debug('TerminadoEventHandler received event for key {}'.format(key))
|
||||
|
Loading…
Reference in New Issue
Block a user