diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py index bb9c4b56..f65da682 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}) diff --git a/glanceclient/tests/unit/test_ssl.py b/glanceclient/tests/unit/test_ssl.py index 69dd399d..9bca2ec7 100644 --- a/glanceclient/tests/unit/test_ssl.py +++ b/glanceclient/tests/unit/test_ssl.py @@ -252,13 +252,5 @@ class TestHTTPSVerifyCert(testtools.TestCase): cacert=cacert) gc.images.get('image123') except exc.CommunicationError as e: - # NOTE(dsariel) - # starting from python 2.7.8 the way of handling x509 certificates - # was changed (github.com/python/peps/blob/master/pep-0476.txt#L28) - # and error message become similar to the one in 3.X - if (six.PY2 and 'certificate' not in e.message and - 'No such file' not in e.message or - six.PY3 and 'No such file' not in e.message): - self.fail('No appropriate failure message is received') - except Exception as e: - self.fail('Unexpected exception has been raised') + if 'invalid path' not in e.message: + raise