diff options
author | Paul Kocialkowski | 2024-05-10 21:40:44 +0200 |
---|---|---|
committer | Paul Kocialkowski | 2024-05-10 21:40:44 +0200 |
commit | 047f989866a51974ed206620fc1c25447a2454ea (patch) | |
tree | a58b08bbc3ce74da2fe1ee8b08ad2d640afc95e0 /host-control | |
parent | 57205fbb273847b14e8edcf7288199a86d985220 (diff) |
host-control: Use local name when resolvable
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'host-control')
-rwxr-xr-x | host-control | 10 |
1 files changed, 7 insertions, 3 deletions
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: |