From 91462de806c53b19041ec2a66265a45ff9e8119c Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 23 Jan 2014 10:32:32 -0500 Subject: [PATCH] catch potential errors resolving hosts Signed-off-by: Alfredo Deza --- ceph_deploy/new.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ceph_deploy/new.py b/ceph_deploy/new.py index 8cf7bc6..9607c3f 100644 --- a/ceph_deploy/new.py +++ b/ceph_deploy/new.py @@ -36,7 +36,10 @@ def get_nonlocal_ip(host): """ Search result of getaddrinfo() for a non-localhost-net address """ - ailist = socket.getaddrinfo(host, None) + try: + ailist = socket.getaddrinfo(host, None) + except socket.gaierror: + raise exc.UnableToResolveError(host) for ai in ailist: # an ai is a 5-tuple; the last element is (ip, port) ip = ai[4][0] -- 2.47.3