From 3a609d36dd8ca5c1cde2b35a8fb84ae84d095d6e Mon Sep 17 00:00:00 2001 From: Radoslav Gerganov Date: Tue, 29 Sep 2015 14:49:53 +0300 Subject: [PATCH] Add support for SSL thumbprint when using FileWriteHandle When doing HTTP PUT to an ESX datastore clients often have SSL thumbprint instead of CA certificate. This patch allows clients to specify the thumbprint when using FileWriteHandle. Change-Id: I3c360e90b5e96446904dfc89015a8ac9ad1c45d0 --- oslo_vmware/rw_handles.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/oslo_vmware/rw_handles.py b/oslo_vmware/rw_handles.py index 4ba56abe..160dd2ca 100644 --- a/oslo_vmware/rw_handles.py +++ b/oslo_vmware/rw_handles.py @@ -242,7 +242,8 @@ class FileWriteHandle(FileHandle): """Write handle for a file in VMware server.""" def __init__(self, host, port, data_center_name, datastore_name, cookies, - file_path, file_size, scheme='https', cacerts=False): + file_path, file_size, scheme='https', cacerts=False, + thumbprint=None): """Initializes the write handle with given parameters. :param host: ESX/VC server IP address or host name @@ -254,6 +255,8 @@ class FileWriteHandle(FileHandle): :param file_path: datastore path where the file is written :param file_size: size of the file in bytes :param scheme: protocol-- http or https + :param cacerts: CA bundle file to use for SSL verification + :param thumbprint: expected SHA1 thumbprint of server's certificate :raises: VimConnectionException, ValueError """ soap_url = self._get_soap_url(scheme, host, port) @@ -265,7 +268,8 @@ class FileWriteHandle(FileHandle): self._url, file_size, cookies=cookies, - cacerts=cacerts) + cacerts=cacerts, + ssl_thumbprint=thumbprint) FileHandle.__init__(self, self._conn) def write(self, data):