From 73b8cb750a6ef60c35010ae43ac330c21393f88c Mon Sep 17 00:00:00 2001 From: Bobbins228 Date: Mon, 7 Oct 2024 10:28:19 +0100 Subject: [PATCH] fix: skip_tls authentication functionality Signed-off-by: Bobbins228 --- src/codeflare_sdk/common/kubernetes_cluster/auth.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/codeflare_sdk/common/kubernetes_cluster/auth.py b/src/codeflare_sdk/common/kubernetes_cluster/auth.py index 2525d2e35..e61460937 100644 --- a/src/codeflare_sdk/common/kubernetes_cluster/auth.py +++ b/src/codeflare_sdk/common/kubernetes_cluster/auth.py @@ -109,14 +109,15 @@ def login(self) -> str: configuration.host = self.server configuration.api_key["authorization"] = self.token - api_client = client.ApiClient(configuration) - if not self.skip_tls: - _client_with_cert(api_client, self.ca_cert_path) - else: + if self.skip_tls: urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) print("Insecure request warnings have been disabled") configuration.verify_ssl = False + api_client = client.ApiClient(configuration) + if not self.skip_tls: + _client_with_cert(api_client, self.ca_cert_path) + client.AuthenticationApi(api_client).get_api_group() config_path = None return "Logged into %s" % self.server