mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 19:51:31 +00:00
Rename & expose as property TerminadoEventHandler.monitor
This commit is contained in:
parent
0a20cffa09
commit
a4b07e549e
@ -10,13 +10,17 @@ class TerminadoEventHandler(TriggerlessEventHandler):
|
|||||||
def __init__(self, key):
|
def __init__(self, key):
|
||||||
super().__init__(key)
|
super().__init__(key)
|
||||||
self.working_directory = tfwenv.TERMINADO_DIR
|
self.working_directory = tfwenv.TERMINADO_DIR
|
||||||
self.monitor = HistoryMonitor(tfwenv.HISTFILE)
|
self._historymonitor = HistoryMonitor(tfwenv.HISTFILE)
|
||||||
self.terminado_server = TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash'])
|
self.terminado_server = TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash'])
|
||||||
self.commands = {'write': self.write,
|
self.commands = {'write': self.write,
|
||||||
'read': self.read}
|
'read': self.read}
|
||||||
self.monitor.watch()
|
self._historymonitor.watch()
|
||||||
self.terminado_server.listen()
|
self.terminado_server.listen()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def historymonitor(self):
|
||||||
|
return self._historymonitor
|
||||||
|
|
||||||
def handle_event(self, key, data_json):
|
def handle_event(self, key, data_json):
|
||||||
log.debug('TerminadoEventHandler received event: {}'.format(data_json))
|
log.debug('TerminadoEventHandler received event: {}'.format(data_json))
|
||||||
data = data_json['data']
|
data = data_json['data']
|
||||||
@ -28,5 +32,5 @@ class TerminadoEventHandler(TriggerlessEventHandler):
|
|||||||
|
|
||||||
def read(self, data):
|
def read(self, data):
|
||||||
data['count'] = int(data.get('count', 1))
|
data['count'] = int(data.get('count', 1))
|
||||||
data['history'] = self.monitor.history[-data['count']:]
|
data['history'] = self.historymonitor.history[-data['count']:]
|
||||||
return data
|
return data
|
||||||
|
Loading…
Reference in New Issue
Block a user