From 4e71f02ba0afdd05d9dd64557e7eb25867dda2e6 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 10 Oct 2023 15:56:16 +0200 Subject: [PATCH] connection: normalize hostname in ConnectionOSErrorException Use the existing helper to provide a properly formatted hostname for user displaying (e.g. for exception); this will fix the printing of IPv6 addresses. Turn the existing "host" member as property, so the current users keep working as expected. Card ID: CCT-9 --- src/rhsm/connection.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rhsm/connection.py b/src/rhsm/connection.py index 489ab2eea6..59d147a68e 100644 --- a/src/rhsm/connection.py +++ b/src/rhsm/connection.py @@ -175,11 +175,15 @@ class ConnectionOSErrorException(ConnectionException): """ def __init__(self, host: str, port: int, handler: str, exc: OSError): - self.host = host + self._host = host self.port = port self.handler = handler self.exc = exc + @property + def host(self) -> str: + return normalized_host(self._host) + class ConnectionType(enum.Enum): """