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 <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-06-23 13:43:29 -04:00
parent 05453b19b2
commit d6e936cd14
2 changed files with 6 additions and 0 deletions

View File

@ -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')

View File

@ -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