Use wrap_socket from ssl.SSLContext instead of ssl
Since Python 3.2 and 2.7.9, it is recommended to use the
SSLContext.wrap_socket() instead of wrap_socket(). The top-level
function is limited and creates an insecure client socket without
server name indication or hostname matching.
[1] https://docs.python.org/3/library/ssl.html#ssl.wrap_socket
Change-Id: I5d61f32760d2715fdb34314f173b0efcec4a2dcf
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
index 03da49a..8fda911 100644
--- a/tempest/common/compute.py
+++ b/tempest/common/compute.py
@@ -15,7 +15,7 @@
import base64
import socket
-import ssl
+from ssl import SSLContext as sslc
import struct
import textwrap
from urllib import parse as urlparse
@@ -395,7 +395,7 @@
af, socktype, proto, _, sa = res
client_socket = socket.socket(af, socktype, proto)
if url.scheme == 'https':
- client_socket = ssl.wrap_socket(client_socket)
+ client_socket = sslc().wrap_socket(client_socket)
client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
client_socket.connect(sa)