diff --git a/confluent_client/bin/confetty b/confluent_client/bin/confetty index e79b121b..48e82d0b 100755 --- a/confluent_client/bin/confetty +++ b/confluent_client/bin/confetty @@ -582,6 +582,8 @@ def do_resize(a, b): return height, width = struct.unpack( 'hh', fcntl.ioctl(sys.stdout, termios.TIOCGWINSZ, b'....'))[:2] + tlvdata.send(session.connection, {'operation': 'resize', 'width': width, + 'height': height}) def startconsole(nodename): diff --git a/confluent_server/confluent/consoleserver.py b/confluent_server/confluent/consoleserver.py index 76fc3d6f..129455f0 100644 --- a/confluent_server/confluent/consoleserver.py +++ b/confluent_server/confluent/consoleserver.py @@ -372,6 +372,7 @@ class ConsoleHandler(object): 'error': self.error}) return self.send_break = self._console.send_break + self.resize = self._console.resize if self._attribwatcher: self.cfgmgr.remove_watcher(self._attribwatcher) self._attribwatcher = None @@ -739,6 +740,10 @@ class ProxyConsole(object): def reopen(self): tlvdata.send(self.remote, {'operation': 'reopen'}) + def resize(self, width, height): + tlvdata.send(self.remote, {'operation': 'resize', 'width': width, + 'height': height}) + # this represents some api view of a console handler. This handles things like # holding the caller specific queue data, for example, when http api should be @@ -807,6 +812,9 @@ class ConsoleSession(object): """ self.conshdl.send_break() + def resize(self, width, height): + self.conshdl.resize(width, height) + def get_buffer_age(self): """Get the age in seconds of the buffered data diff --git a/confluent_server/confluent/interface/console.py b/confluent_server/confluent/interface/console.py index df0ef255..f2176dcd 100644 --- a/confluent_server/confluent/interface/console.py +++ b/confluent_server/confluent/interface/console.py @@ -41,6 +41,11 @@ class Console(object): the remote console""" return + def resize(self, width, height): + """This function is responsible for relaying resize request from + client terminal to remote console""" + return + def ping(self): """This function is a hint to the console plugin that now would be a nice time to assess health of console connection. Plugins that see diff --git a/confluent_server/confluent/plugins/shell/ssh.py b/confluent_server/confluent/plugins/shell/ssh.py index d0b5e90b..8073bdce 100644 --- a/confluent_server/confluent/plugins/shell/ssh.py +++ b/confluent_server/confluent/plugins/shell/ssh.py @@ -82,6 +82,9 @@ class SshShell(conapi.Console): self.password = password self.inputmode = 0 # 0 = username, 1 = password... + def resize(self, width, height): + self.shell.resize_pty(width=width, height=height) + def recvdata(self): while self.connected: pendingdata = self.shell.recv(8192) diff --git a/confluent_server/confluent/sockapi.py b/confluent_server/confluent/sockapi.py index ac4c5786..3b389508 100644 --- a/confluent_server/confluent/sockapi.py +++ b/confluent_server/confluent/sockapi.py @@ -291,6 +291,9 @@ def term_interact(authdata, authname, ccons, cfm, connection, consession, elif data['operation'] == 'reopen': consession.reopen() continue + elif data['operation'] == 'resize': + consession.resize(width=data['width'], height=data['height']) + continue else: try: process_request(connection, data, cfm, authdata, authname,