mirror of
https://github.com/xcat2/confluent.git
synced 2024-12-24 12:11:52 +00:00
Auto-migrate open console session on loss of management
This will keep consoles connected across a manager change. Note that as it stands, a console session enduring multiple changes will become increasingly convoluted as the redirect chain will increase every time, rather than shorting back to the entry point.
This commit is contained in:
parent
d34e65f9b7
commit
f45228c067
@ -240,6 +240,7 @@ class ConsoleHandler(object):
|
||||
# Do not do console connect for nodes managed by another
|
||||
# confluent collective member
|
||||
self._is_local = False
|
||||
self._detach()
|
||||
self._disconnect()
|
||||
else:
|
||||
self._is_local = True
|
||||
@ -306,6 +307,10 @@ class ConsoleHandler(object):
|
||||
'none or interactive,\r\nconnection loss, or service restart]')
|
||||
self.clearpending = True
|
||||
|
||||
def _detach(self):
|
||||
for ses in list(self.livesessions):
|
||||
ses.detach()
|
||||
|
||||
def _disconnect(self):
|
||||
if self.connectionthread:
|
||||
self.connectionthread.kill()
|
||||
@ -752,9 +757,6 @@ class ConsoleSession(object):
|
||||
it is a hook for confluent to abstract the concept of a terminal
|
||||
between console and shell.
|
||||
"""
|
||||
#TODO(jjohnosn2): collective mode, connect to collective manager
|
||||
#if not self. This avoids sockapi and httpapi from having to
|
||||
#understand the situation
|
||||
self.conshdl = connect_node(self.node, self.configmanager,
|
||||
self.username)
|
||||
def send_break(self):
|
||||
@ -794,7 +796,10 @@ class ConsoleSession(object):
|
||||
|
||||
:return:
|
||||
"""
|
||||
pass
|
||||
self.conshdl.detachsession(self)
|
||||
self.connect_session()
|
||||
self.conshdl.attachsession(self)
|
||||
self.write = self.conshdl.write
|
||||
|
||||
def got_data(self, data):
|
||||
"""Receive data from console and buffer
|
||||
|
Loading…
Reference in New Issue
Block a user