Merge "Support testing nova-novncproxy on SSL"

This commit is contained in:
Jenkins 2017-04-27 18:58:25 +00:00 committed by Gerrit Code Review
commit 192e64e66b

View File

@ -15,6 +15,7 @@
import base64
import socket
import ssl
import struct
import textwrap
@ -236,6 +237,10 @@ def shelve_server(servers_client, server_id, force_shelve_offload=False):
def create_websocket(url):
url = urlparse.urlparse(url)
if url.scheme == 'https':
client_socket = ssl.wrap_socket(socket.socket(socket.AF_INET,
socket.SOCK_STREAM))
else:
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
client_socket.connect((url.hostname, url.port))