Skip to content

Commit 92ddbbf

Browse files
authored
Merge pull request #746 from pinheadmz/ln-status
status: clean up and include LNs
2 parents fe42c6d + a6bc767 commit 92ddbbf

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/warnet/network.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def _connected(end="\n"):
7878
actual += 1
7979
expected = int(tank.metadata.annotations["init_peers"])
8080
print(
81-
f"Tank {tank.metadata.name} peers expected: {expected}, actual: {actual}", end=end
81+
f"Tank: {tank.metadata.name:<15} peers expected: {expected:<3} actual: {actual:<3}",
82+
end=end,
8283
)
8384
# Even if more edges are specified, bitcoind only allows
8485
# 8 manual outbound connections

src/warnet/status.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from rich.text import Text
99
from urllib3.exceptions import MaxRetryError
1010

11-
from .constants import COMMANDER_MISSION, TANK_MISSION
11+
from .constants import COMMANDER_MISSION, LIGHTNING_MISSION, TANK_MISSION
1212
from .k8s import get_mission
1313
from .network import _connected
1414

@@ -20,6 +20,7 @@ def status():
2020

2121
try:
2222
tanks = _get_tank_status()
23+
lns = _get_ln_status()
2324
scenarios = _get_deployed_scenarios()
2425
except ConfigException as e:
2526
print(e)
@@ -52,6 +53,13 @@ def status():
5253
for tank in tanks:
5354
table.add_row("Tank", tank["name"], tank["status"], tank["namespace"])
5455

56+
# Add a separator if there are both tanks and scenarios
57+
if tanks and lns:
58+
table.add_row("", "", "")
59+
60+
for ln in lns:
61+
table.add_row("Lightning", ln["name"], ln["status"], ln["namespace"])
62+
5563
# Add a separator if there are both tanks and scenarios
5664
if tanks and scenarios:
5765
table.add_row("", "", "")
@@ -98,6 +106,18 @@ def _get_tank_status():
98106
]
99107

100108

109+
def _get_ln_status():
110+
tanks = get_mission(LIGHTNING_MISSION)
111+
return [
112+
{
113+
"name": tank.metadata.name,
114+
"status": tank.status.phase.lower(),
115+
"namespace": tank.metadata.namespace,
116+
}
117+
for tank in tanks
118+
]
119+
120+
101121
def _get_deployed_scenarios():
102122
commanders = get_mission(COMMANDER_MISSION)
103123
return [

0 commit comments

Comments
 (0)