DS8K: correct the usage for ssl method(SSLContext.wrap_socket)

Since Python 3.2 and 2.7.9, it is recommended to use the
SSLContext.wrap_socket() instead of wrap_socket(). So the patch
https://review.openstack.org/#/c/591608/ help to optimize it. But the
usage of SSLContext.wrap_socket() is wrong, it caused DS8K cinder
driver can not be initialized, so this patch will correct it.

Change-Id: Ia015f3b48796dec79dd68b8d393e920a03dfa585
Closes-Bug: 1797847
This commit is contained in:
Peng Wang 2018-10-15 01:39:30 -07:00
parent deb3c99107
commit b742179f33
1 changed files with 2 additions and 1 deletions

View File

@ -114,7 +114,8 @@ class DS8KHTTPSConnection(connection.VerifiedHTTPSConnection):
# Wrap socket using verification with the root certs in
# trusted_root_certs
self.sock = ssl.SSLContext.wrap_socket(conn)
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
self.sock = context.wrap_socket(conn)
self._verify_cert(self.sock, self.ca_certs)
self.is_verified = True