From 047f989866a51974ed206620fc1c25447a2454ea Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Fri, 10 May 2024 21:40:44 +0200 Subject: host-control: Use local name when resolvable Signed-off-by: Paul Kocialkowski --- host-control | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'host-control') diff --git a/host-control b/host-control index f337bf1..7e1f571 100755 --- a/host-control +++ b/host-control @@ -83,10 +83,14 @@ class host_control(): # host def host_address(self, host): - if "address" in host: - return host["address"] - else: + try: + socket.getaddrinfo(host["name"], None) return host["name"] + except OSError: + if "address" in host: + return host["address"] + else: + return host["name"] def host_lookup(self, name): for h in self.hosts: -- cgit v1.2.3