1+ import sys
2+
13import click
4+ from kubernetes .config .config_exception import ConfigException
25from rich .console import Console
36from rich .panel import Panel
47from rich .table import Table
58from rich .text import Text
9+ from urllib3 .exceptions import MaxRetryError
610
711from .k8s import get_mission
812from .network import _connected
@@ -13,8 +17,28 @@ def status():
1317 """Display the unified status of the Warnet network and active scenarios"""
1418 console = Console ()
1519
16- tanks = _get_tank_status ()
17- scenarios = _get_deployed_scenarios ()
20+ try :
21+ tanks = _get_tank_status ()
22+ scenarios = _get_deployed_scenarios ()
23+ except ConfigException as e :
24+ print (e )
25+ print (
26+ "The kubeconfig file has not been properly set. This may mean that you need to "
27+ "authorize with a cluster such as by starting minikube, starting docker-desktop, or "
28+ "authorizing with a configuration file provided by a cluster administrator."
29+ )
30+ sys .exit (1 )
31+ except MaxRetryError as e :
32+ print (e )
33+ print (
34+ "Warnet cannot get the status of a Warnet network. To resolve this, you may need to "
35+ "confirm you have access to a Warnet cluster. Start by checking your network "
36+ "connection. Then, if running a local cluster, check that minikube or docker-desktop "
37+ "is running properly. If you are trying to connect to a remote cluster, check that "
38+ "the relevant authorization file has been configured properly as instructed by a "
39+ "cluster administrator."
40+ )
41+ sys .exit (1 )
1842
1943 # Create a unified table
2044 table = Table (title = "Warnet Status" , show_header = True , header_style = "bold magenta" )
0 commit comments