From d6e936cd14f0954751dfc1b754f08deb166a53bf Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Fri, 23 Jun 2017 13:43:29 -0400 Subject: [PATCH] add explicit dependency on pyopenssl The library is used in glanceclient/common/https.py and the documentation build for the API fails without the dependency. Update the error handling so that when OpenSSL reports an error it is converted to a client communication error. Change-Id: I0c0fb3139bb848d0cbaf88ae6a767a730bea74eb Signed-off-by: Doug Hellmann --- glanceclient/common/http.py | 5 +++++ requirements.txt | 1 + 2 files changed, 6 insertions(+) diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py index 5b4981e8..35ef282c 100644 --- a/glanceclient/common/http.py +++ b/glanceclient/common/http.py @@ -19,6 +19,7 @@ import socket from keystoneauth1 import adapter from keystoneauth1 import exceptions as ksa_exc +import OpenSSL from oslo_utils import importutils from oslo_utils import netutils import requests @@ -267,6 +268,10 @@ class HTTPClient(_BaseHTTPClient): message = ("Error communicating with %(endpoint)s %(e)s" % {'endpoint': endpoint, 'e': e}) raise exc.CommunicationError(message=message) + except OpenSSL.SSL.Error as e: + message = ("SSL Error communicating with %(url)s: %(e)s" % + {'url': conn_url, 'e': e}) + raise exc.CommunicationError(message=message) # log request-id for each api call request_id = resp.headers.get('x-openstack-request-id') diff --git a/requirements.txt b/requirements.txt index c22647d7..45fb32d9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ six>=1.9.0 # MIT oslo.utils>=3.20.0 # Apache-2.0 oslo.i18n!=3.15.2,>=2.1.0 # Apache-2.0 wrapt>=1.7.0 # BSD License +pyOpenSSL>=0.14 # Apache-2.0