Skip to content

Commit

Permalink
adding try/except to load kubeconfig
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Haigh <[email protected]>
  • Loading branch information
MichaelHaigh committed Nov 14, 2023
1 parent 683dca2 commit 15e02a2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion astraSDK/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,14 @@ def printVerbose(self, url, method, headers, data, params):
class KubeCommon(BaseCommon):
def __init__(self):
super().__init__()
self.kube_config = kubernetes.config.load_kube_config()
try:
self.kube_config = kubernetes.config.load_kube_config()
except kubernetes.config.config_exception.ConfigException as err:
self.printError(f"{err}\n")
raise SystemExit()
except Exception as err:
self.printError(
"Error loading kubeconfig, please check kubeconfig file to ensure it is valid\n"
)
self.printError(f"{err}\n")
raise SystemExit()

0 comments on commit 15e02a2

Please sign in to comment.