1
+ import sys
2
+
1
3
import click
4
+ from kubernetes .config .config_exception import ConfigException
2
5
from rich .console import Console
3
6
from rich .panel import Panel
4
7
from rich .table import Table
5
8
from rich .text import Text
9
+ from urllib3 .exceptions import MaxRetryError
6
10
7
11
from .k8s import get_mission
8
12
from .network import _connected
@@ -13,8 +17,28 @@ def status():
13
17
"""Display the unified status of the Warnet network and active scenarios"""
14
18
console = Console ()
15
19
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 )
18
42
19
43
# Create a unified table
20
44
table = Table (title = "Warnet Status" , show_header = True , header_style = "bold magenta" )
0 commit comments