atlasbot: improve worker node answers

This commit is contained in:
Brad Stein 2026-01-26 18:18:42 -03:00
parent 7bb1bd96fc
commit 65781aaca7
2 changed files with 12 additions and 6 deletions

View File

@ -16,7 +16,7 @@ spec:
labels: labels:
app: atlasbot app: atlasbot
annotations: annotations:
checksum/atlasbot-configmap: manual-atlasbot-14 checksum/atlasbot-configmap: manual-atlasbot-15
vault.hashicorp.com/agent-inject: "true" vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/role: "comms" vault.hashicorp.com/role: "comms"
vault.hashicorp.com/agent-inject-secret-turn-secret: "kv/data/atlas/comms/turn-shared-secret" vault.hashicorp.com/agent-inject-secret-turn-secret: "kv/data/atlas/comms/turn-shared-secret"

View File

@ -1097,6 +1097,7 @@ def sync_loop(token: str, room_id: str):
ready_nodes, not_ready_nodes = worker_nodes_status() ready_nodes, not_ready_nodes = worker_nodes_status()
total = len(ready_nodes) + len(not_ready_nodes) total = len(ready_nodes) + len(not_ready_nodes)
if total: if total:
missing_hint = missing_nodes_answer("Atlas")
if any(word in lower_body for word in ("ready", "not ready", "unready")): if any(word in lower_body for word in ("ready", "not ready", "unready")):
if not_ready_nodes: if not_ready_nodes:
send_msg( send_msg(
@ -1105,14 +1106,19 @@ def sync_loop(token: str, room_id: str):
f"Worker nodes not Ready: {', '.join(not_ready_nodes)}.", f"Worker nodes not Ready: {', '.join(not_ready_nodes)}.",
) )
else: else:
send_msg(token, rid, f"All {len(ready_nodes)} worker nodes are Ready.") msg = f"All {len(ready_nodes)} worker nodes are Ready."
if missing_hint and "no missing" not in missing_hint:
msg += f" {missing_hint}"
send_msg(token, rid, msg)
continue continue
if any(word in lower_body for word in ("how many", "should")): if any(word in lower_body for word in ("how many", "should")):
send_msg( msg = (
token, f"Atlas has {total} worker nodes; "
rid, f"{len(ready_nodes)} Ready, {len(not_ready_nodes)} NotReady."
f"Atlas has {total} worker nodes; {len(ready_nodes)} Ready, {len(not_ready_nodes)} NotReady.",
) )
if missing_hint and "no missing" not in missing_hint:
msg += f" {missing_hint}"
send_msg(token, rid, msg)
continue continue
if "missing" in lower_body and "node" in lower_body: if "missing" in lower_body and "node" in lower_body:
missing = missing_nodes_answer("Atlas") missing = missing_nodes_answer("Atlas")