Skip to content

Commit

Permalink
Login method error return
Browse files Browse the repository at this point in the history
  • Loading branch information
oksanabaza authored and openshift-merge-bot[bot] committed Feb 14, 2024
1 parent 5f0fc09 commit d987838
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/codeflare_sdk/cluster/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ def login(self) -> str:
client.AuthenticationApi(api_client).get_api_group()
config_path = None
return "Logged into %s" % self.server
except client.ApiException: # pragma: no cover
api_client = None
print("Authentication Error please provide the correct token + server")
except client.ApiException as e:
_kube_api_error_handling(e)

def logout(self) -> str:
"""
Expand Down
4 changes: 3 additions & 1 deletion src/codeflare_sdk/utils/kube_api_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def _kube_api_error_handling(
print(nf_msg)
return
elif e.reason == "Unauthorized" or e.reason == "Forbidden":
raise PermissionError(perm_msg)
if print_error:
print(perm_msg)
return
elif e.reason == "Conflict":
raise FileExistsError(exists_msg)
raise e

0 comments on commit d987838

Please sign in to comment.