summaryrefslogtreecommitdiff
path: root/glanceclient/common
diff options
context:
space:
mode:
authorEric Fried <efried@us.ibm.com>2017-05-19 14:53:34 -0400
committerEric Fried <efried@us.ibm.com>2017-05-19 14:59:58 -0400
commit7df87fd4a26ebee3899fbc42d21757bf880a10d4 (patch)
treeb361a74745cc0c8764c6df07172b727e770b306c /glanceclient/common
parenta0edf0c2bfb7bcc8253aaf46f6a67607e9b09048 (diff)
downloadpython-glanceclient-7df87fd4a26ebee3899fbc42d21757bf880a10d4.tar.gz
Convert IOError from requests
This requests commit [1] changed the behavior when a nonexistent cacert file is passed in: now it raises IOError. This is getting through glanceclient.common.http.HTTPClient._request, which used to raise CommunicationError in this scenario. Even though there is arguably a better exception than CommunicationError to represent this condition (like maybe IOError), for backward compatibility this change set converts IOError to CommunicationError. We also improve the unit test to raise the original exception if the expected conditions aren't met; this improves debugability. [1] https://github.com/kennethreitz/requests/commit/7d8b87c37f3a5fb993fd83eda6888ac217cd108e Change-Id: I6a2cf4c6d041b67d3509153b4cef18b459263648 Closes-Bug: #1692085
Diffstat (limited to 'glanceclient/common')
-rw-r--r--glanceclient/common/http.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py
index bb9c4b5..f65da68 100644
--- a/glanceclient/common/http.py
+++ b/glanceclient/common/http.py
@@ -257,7 +257,7 @@ class HTTPClient(_BaseHTTPClient):
message = "Error finding address for %s: %s" % (
self.endpoint_hostname, e)
raise exc.InvalidEndpoint(message=message)
- except (socket.error, socket.timeout) as e:
+ except (socket.error, socket.timeout, IOError) as e:
endpoint = self.endpoint
message = ("Error communicating with %(endpoint)s %(e)s" %
{'endpoint': endpoint, 'e': e})