summaryrefslogtreecommitdiff
path: root/host-control
diff options
context:
space:
mode:
Diffstat (limited to 'host-control')
-rwxr-xr-xhost-control10
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: