Skip to content

Commit

Permalink
Updated error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobbins228 authored and openshift-merge-robot committed Aug 21, 2023
1 parent 16d23d7 commit 77a82e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/codeflare_sdk/cluster/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import abc
from kubernetes import client, config
import os
from ..utils.kube_api_helpers import _kube_api_error_handling

global api_client
api_client = None
Expand Down Expand Up @@ -168,12 +169,12 @@ def config_check() -> str:
try:
config.load_kube_config()
except Exception as e: # pragma: no cover
print(e)
_kube_api_error_handling(e)
elif "KUBERNETES_PORT" in os.environ:
try:
config.load_incluster_config()
except Exception as e: # pragma: no cover
print(e)
_kube_api_error_handling(e)
else:
raise PermissionError(
"Action not permitted, have you put in correct/up-to-date auth credentials?"
Expand Down

0 comments on commit 77a82e2

Please sign in to comment.