From da0499106777802f1280e5f1189989937d044027 Mon Sep 17 00:00:00 2001 From: wanyunSu Date: Thu, 30 Oct 2025 15:21:23 +0100 Subject: [PATCH] handle herror in socket --- src/drunc/controller/interface/shell_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/drunc/controller/interface/shell_utils.py b/src/drunc/controller/interface/shell_utils.py index 7785fc9ab..3751989c3 100644 --- a/src/drunc/controller/interface/shell_utils.py +++ b/src/drunc/controller/interface/shell_utils.py @@ -113,7 +113,10 @@ def update_endpoint(endpoint: str) -> str: ip_address = urlparse(endpoint).hostname if not ip_address: return "" - hostname, _, _ = socket.gethostbyaddr(ip_address) + try: + hostname, _, _ = socket.gethostbyaddr(ip_address) + except socket.herror: + return ip_address return endpoint.replace(ip_address, hostname) table.add_row(