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 <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-04-10 14:04:19 +02:00
commit 61c1a628a1

View file

@ -26,7 +26,10 @@ class SSHClient(ExecContext):
except Exception as e: except Exception as e:
log(ERR, f'Failed to parse SSH URI "{uri}"') log(ERR, f'Failed to parse SSH URI "{uri}"')
raise raise
self.__hostname = parsed.hostname 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.__port = parsed.port
self.__password = parsed.password self.__password = parsed.password
self.__username = parsed.username self.__username = parsed.username