diff --git a/lib/live_cluster/ssh.py b/lib/live_cluster/ssh.py index 003328e5..4e1777a6 100644 --- a/lib/live_cluster/ssh.py +++ b/lib/live_cluster/ssh.py @@ -125,7 +125,7 @@ async def create_connection(self, ip) -> SSHConnection: async with SSHConnectionFactory.semaphore_host_dict[ip].semaphore: logger.debug(f"{ip}: Creating connection") return SSHConnection(await asyncssh.connect(ip, options=self.opts)) - except asyncssh.DisconnectError as e: + except (asyncssh.DisconnectError, ConnectionRefusedError) as e: raise SSHConnectionError(e) finally: SSHConnectionFactory.semaphore_host_dict[ip].count -= 1