From 61c1a628a114b5435e1f90dad6a869e5ccffb848 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Fri, 10 Apr 2026 14:04:19 +0200 Subject: [PATCH] lib.ec.SSHClient: Exception for empty host name Instantiating a SSHClient-derived class with an invalid or missing uri parameter is accepted and fails later down the road. Raise an Exception early on to make the error log more comprehensible. Signed-off-by: Jan Lindemann --- src/python/jw/pkg/lib/ec/SSHClient.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/python/jw/pkg/lib/ec/SSHClient.py b/src/python/jw/pkg/lib/ec/SSHClient.py index d6aaffd3..9b11a59b 100644 --- a/src/python/jw/pkg/lib/ec/SSHClient.py +++ b/src/python/jw/pkg/lib/ec/SSHClient.py @@ -26,7 +26,10 @@ class SSHClient(ExecContext): except Exception as e: log(ERR, f'Failed to parse SSH URI "{uri}"') raise + self.__hostname = parsed.hostname + if self.__hostname is None: + raise Exception(f'Can\'t parse host name from SSH URI "{uri}"') self.__port = parsed.port self.__password = parsed.password self.__username = parsed.username