Report name resolution errors properly

Errors in name resolution have been logged previously with the url path
rather than the hostname. That resulted in incorrect errors like:

InvalidEndpoint: Error finding address for
/v1/images/detail?is_public=none&limit=20: [Errno -2]
Name or service not known

rather than one mentioning hostname itself. This patch changes the log
message to fit the situation.

Change-Id: I1eecbcb22d41b1341c214937b9cbfd046fd301a0
This commit is contained in:
Stanislaw Pitucha
2013-02-19 15:40:16 +00:00
parent d831b5eb27
commit 7f7c9a1d85
2 changed files with 44 additions and 1 deletions
+2 -1
View File
@@ -183,7 +183,8 @@ class HTTPClient(object):
conn.request(method, conn_url, **kwargs)
resp = conn.getresponse()
except socket.gaierror as e:
message = "Error finding address for %(url)s: %(e)s" % locals()
message = "Error finding address for %s: %s" % (
self.endpoint_hostname, e)
raise exc.InvalidEndpoint(message=message)
except (socket.error, socket.timeout) as e:
endpoint = self.endpoint