From: Alfredo Deza Date: Thu, 23 Jan 2014 15:32:32 +0000 (-0500) Subject: catch potential errors resolving hosts X-Git-Tag: v1.3.5~9^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F154%2Fhead;p=ceph-deploy.git catch potential errors resolving hosts Signed-off-by: Alfredo Deza --- 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]