Browse Source

Avoid invoking session/create API with client cert

This fails on NSX since the API is only supported with basic auth.

Change-Id: I4043836d9b0d96ec659f33cef19ec31b73747667
changes/27/758227/1
Anna Khmelnitsky 2 years ago
parent
commit
f81be47cb7
  1. 11
      vmware_nsxlib/v3/cluster.py

11
vmware_nsxlib/v3/cluster.py

@ -241,6 +241,12 @@ class NSXRequestsHTTPProvider(AbstractHTTPProvider):
# Add allow-overwrite if configured
if allow_overwrite_header:
session.default_headers['X-Allow-Overwrite'] = 'true'
if session.cert_provider:
# Session create will fail with cert provider
LOG.debug("Skipping session create with client certificate auth")
return
# Perform the initial session create and get the relevant jsessionid &
# X-XSRF-TOKEN for future requests
req_data = ''
@ -258,11 +264,6 @@ class NSXRequestsHTTPProvider(AbstractHTTPProvider):
LOG.error("Session create failed for endpoint %s due to "
"error in retrieving JSON Web Token: %s",
provider.url, e)
elif session.cert_provider:
# Session create will fail without token_provider, returning 403
LOG.debug("Skipping get_default_headers due to missing "
"token_provider")
return
else:
# With client certificate authentication, username and password
# may not be provided.

Loading…
Cancel
Save