Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2bbfb62

Browse files
author
ddraganov
committed
Add certFile and certKeyFile to SoapStubAdapter
SoapStubAdapter uses the schemeArgs dictionary to pass HTTPConnection and HTTPSConnection parameters around. However, with the planned Python 3.12 changes, some parameters will no longer be supported. This changes adds certFile and certKeyFile as SoapStubAdapter class attributes and updates the current consumers.
1 parent 5a2a74e commit 2bbfb62

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

pyVim/connect.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#############################################################
2-
# Copyright (c) 2005-2024 VMware, Inc. All rights reserved.
2+
# Copyright (c) 2005-2024 Broadcom. All Rights Reserved.
3+
# The term "Broadcom" refers to Broadcom Inc.
4+
# and/or its subsidiaries.
35
#############################################################
46

57
# @file connect.py
@@ -132,8 +134,8 @@ def makeCertHokTokenLoginMethod(stsUrl, stsCert=None, ssl_context=None):
132134

133135
def _doLogin(soapStub):
134136
from . import sso
135-
cert = soapStub.schemeArgs['cert_file']
136-
key = soapStub.schemeArgs['key_file']
137+
cert = soapStub.certFile
138+
key = soapStub.certKeyFile
137139
authenticator = sso.SsoAuthenticator(sts_url=stsUrl,
138140
sts_cert=stsCert)
139141

@@ -177,8 +179,8 @@ def makeCredBearerTokenLoginMethod(username,
177179

178180
def _doLogin(soapStub):
179181
from . import sso
180-
cert = soapStub.schemeArgs['cert_file']
181-
key = soapStub.schemeArgs['key_file']
182+
cert = soapStub.certFile
183+
key = soapStub.certKeyFile
182184
authenticator = sso.SsoAuthenticator(sts_url=stsUrl,
183185
sts_cert=stsCert)
184186
samlAssertion = authenticator.get_bearer_saml_assertion(

pyVmomi/SoapAdapter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,8 @@ def __init__(self,
14781478
self.pool = []
14791479
self.connectionPoolTimeout = connectionPoolTimeout
14801480
self.lock = threading.Lock()
1481+
self.certFile = certFile
1482+
self.certKeyFile = certKeyFile
14811483
self.schemeArgs = {}
14821484
if sslContext:
14831485
self.schemeArgs['context'] = sslContext

0 commit comments

Comments
 (0)