Skip to content

Commit

Permalink
connection: normalize hostname in ConnectionOSErrorException
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ptoscano committed Oct 10, 2023
1 parent 8d7acd3 commit 4e71f02
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rhsm/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit 4e71f02

Please sign in to comment.