From f3749e83ec54323873029ec9ad468f9fae19bb84 Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 7 Nov 2024 14:52:59 +1000 Subject: [PATCH] Catch error when cannot resize Docker container TTY. --- gns3server/compute/base_node.py | 10 ++++------ gns3server/compute/docker/docker_vm.py | 5 ++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gns3server/compute/base_node.py b/gns3server/compute/base_node.py index 13da0a8c..c95138e4 100644 --- a/gns3server/compute/base_node.py +++ b/gns3server/compute/base_node.py @@ -406,13 +406,11 @@ class BaseNode: Stops the telnet proxy. """ - if self._wrapper_telnet_server: + if self._wrap_console_writer: self._wrap_console_writer.close() - if sys.version_info >= (3, 7, 0): - try: - await self._wrap_console_writer.wait_closed() - except ConnectionResetError: - pass + await self._wrap_console_writer.wait_closed() + self._wrap_console_writer = None + if self._wrapper_telnet_server: self._wrapper_telnet_server.close() await self._wrapper_telnet_server.wait_closed() self._wrapper_telnet_server = None diff --git a/gns3server/compute/docker/docker_vm.py b/gns3server/compute/docker/docker_vm.py index 334af520..24a70e94 100644 --- a/gns3server/compute/docker/docker_vm.py +++ b/gns3server/compute/docker/docker_vm.py @@ -710,7 +710,10 @@ class DockerVM(BaseNode): """ # resize the container TTY. - await self._manager.query("POST", "containers/{}/resize?h={}&w={}".format(self._cid, rows, columns)) + try: + await self._manager.query("POST", "containers/{}/resize?h={}&w={}".format(self._cid, rows, columns)) + except DockerError as e: + log.warning(f"Could not resize the container TTY: {e}") async def _start_console(self): """