diff --git a/src/warnet/network.py b/src/warnet/network.py index e6658ae8c..920269f00 100644 --- a/src/warnet/network.py +++ b/src/warnet/network.py @@ -78,7 +78,8 @@ def _connected(end="\n"): actual += 1 expected = int(tank.metadata.annotations["init_peers"]) print( - f"Tank {tank.metadata.name} peers expected: {expected}, actual: {actual}", end=end + f"Tank: {tank.metadata.name:<15} peers expected: {expected:<3} actual: {actual:<3}", + end=end, ) # Even if more edges are specified, bitcoind only allows # 8 manual outbound connections diff --git a/src/warnet/status.py b/src/warnet/status.py index c94f014cc..4055d915b 100644 --- a/src/warnet/status.py +++ b/src/warnet/status.py @@ -8,7 +8,7 @@ from rich.text import Text from urllib3.exceptions import MaxRetryError -from .constants import COMMANDER_MISSION, TANK_MISSION +from .constants import COMMANDER_MISSION, LIGHTNING_MISSION, TANK_MISSION from .k8s import get_mission from .network import _connected @@ -20,6 +20,7 @@ def status(): try: tanks = _get_tank_status() + lns = _get_ln_status() scenarios = _get_deployed_scenarios() except ConfigException as e: print(e) @@ -52,6 +53,13 @@ def status(): for tank in tanks: table.add_row("Tank", tank["name"], tank["status"], tank["namespace"]) + # Add a separator if there are both tanks and scenarios + if tanks and lns: + table.add_row("", "", "") + + for ln in lns: + table.add_row("Lightning", ln["name"], ln["status"], ln["namespace"]) + # Add a separator if there are both tanks and scenarios if tanks and scenarios: table.add_row("", "", "") @@ -98,6 +106,18 @@ def _get_tank_status(): ] +def _get_ln_status(): + tanks = get_mission(LIGHTNING_MISSION) + return [ + { + "name": tank.metadata.name, + "status": tank.status.phase.lower(), + "namespace": tank.metadata.namespace, + } + for tank in tanks + ] + + def _get_deployed_scenarios(): commanders = get_mission(COMMANDER_MISSION) return [