@astrofoundry/pi-astro 0.40.42 → 0.40.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -200,6 +200,11 @@ describe("morning summary", () => {
|
|
|
200
200
|
"⚠️ **Backup** · Backup: the restic check ended with exit-code\nFound by the morning run; the backup specialist can look into it here.\n<@178096425509453824>",
|
|
201
201
|
);
|
|
202
202
|
});
|
|
203
|
+
|
|
204
|
+
it("names the specialist that reads an area of another name, and none for macOS", () => {
|
|
205
|
+
expect(problemText({ area: "Updates", line: "x", problem: "Updates: no update list from radius" }, ["1"])).toBe("⚠️ **Updates** · Updates: no update list from radius\nFound by the morning run; the proxmox specialist can look into it here.\n<@1>");
|
|
206
|
+
expect(problemText({ area: "macOS", line: "x", problem: "macOS: no macOS update list from Nexus" }, ["1"])).toBe("⚠️ **macOS** · macOS: no macOS update list from Nexus\nFound by the morning run; ask about it here.\n<@1>");
|
|
207
|
+
});
|
|
203
208
|
});
|
|
204
209
|
|
|
205
210
|
describe("report summaries", () => {
|
|
@@ -424,7 +424,12 @@ export function summaryText(s: Summary): string {
|
|
|
424
424
|
return [head, ...reports, ...areas, ...(needs.length > 0 ? [`Needs you · ${needs.map((n, i) => `${i + 1}) ${n}`).join(" ")}`] : [])].join("\n");
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
+
/** Areas read by a specialist of another name, or by none: Cortex's macOS is this host's own. */
|
|
428
|
+
const AREA_SPECIALIST: Readonly<Record<string, string | null>> = { Updates: "proxmox", macOS: null };
|
|
429
|
+
|
|
427
430
|
/** The tagged message for one area's problem in its routed channel. */
|
|
428
431
|
export function problemText(a: AreaStatus, owners: readonly string[]): string {
|
|
429
|
-
|
|
432
|
+
const specialist = Object.hasOwn(AREA_SPECIALIST, a.area) ? AREA_SPECIALIST[a.area] : a.area.toLowerCase();
|
|
433
|
+
const who = specialist === null ? "ask about it here" : `the ${escapeDiscord(specialist)} specialist can look into it here`;
|
|
434
|
+
return `⚠️ **${escapeDiscord(a.area)}** · ${escapeDiscord(a.problem ?? a.line)}\nFound by the morning run; ${who}.\n${owners.map((id) => `<@${id}>`).join(" ")}`;
|
|
430
435
|
}
|
|
@@ -624,12 +624,13 @@ class Bridge {
|
|
|
624
624
|
/** Every configured specialist's status, read through its wrapper without a model. */
|
|
625
625
|
private async collectAreas(): Promise<AreaStatus[]> {
|
|
626
626
|
const present = new Set(this.specialists().names);
|
|
627
|
-
const text = (service: string, args: string[]) => this.runEntry(service, AUTO_CALLER, args, 3 * 60_000).catch(() => null);
|
|
627
|
+
const text = (service: string, args: string[]) => this.runEntry(service, AUTO_CALLER, args, 3 * 60_000).catch((err) => (log(`daily: ${service} ${args.join(" ")} failed: ${err instanceof Error ? err.message : String(err)}`), null));
|
|
628
628
|
const json = async (service: string, args: string[]) => {
|
|
629
629
|
const out = await text(service, args);
|
|
630
630
|
try {
|
|
631
631
|
return out === null ? null : (JSON.parse(out) as unknown);
|
|
632
632
|
} catch {
|
|
633
|
+
log(`daily: ${service} ${args.join(" ")} returned no JSON`);
|
|
633
634
|
return null;
|
|
634
635
|
}
|
|
635
636
|
};
|
|
@@ -637,21 +638,22 @@ class Bridge {
|
|
|
637
638
|
if (present.has("backup")) areas.push((async () => backupStatus(await json("backup", ["vzdump-archives"]), await text("backup", ["restic-check-status"]), Date.now()))());
|
|
638
639
|
if (present.has("edge")) areas.push((async () => edgeStatus(await text("edge", ["vps", "status"]), await text("edge", ["vps", "updates"])))());
|
|
639
640
|
if (present.has("proxmox")) {
|
|
641
|
+
const proxmox = (async () => {
|
|
642
|
+
const hosts: ProxmoxHost[] = [];
|
|
643
|
+
for (const h of PROXMOX_HOSTS) {
|
|
644
|
+
const before = await text("proxmox", [...h.prefix, "updates"]);
|
|
645
|
+
// Host packages install on their own; a new Proxmox VE major is held by the entry script for the owner.
|
|
646
|
+
const upgrade = before !== null && pendingPackageLines(before).length > 0 ? await this.runEntry("proxmox", AUTO_CALLER, [...h.prefix, "host-upgrade"], HOST_UPGRADE_MS).catch((err) => (log(`daily: ${h.name} host-upgrade failed: ${err instanceof Error ? err.message : String(err)}`), null)) : undefined;
|
|
647
|
+
const updates = upgrade === undefined ? before : await text("proxmox", [...h.prefix, "updates"]);
|
|
648
|
+
hosts.push({ name: h.name, id: h.id, status: await text("proxmox", [...h.prefix, "host-status"]), updates, upgrade });
|
|
649
|
+
}
|
|
650
|
+
return proxmoxStatus(hosts);
|
|
651
|
+
})();
|
|
652
|
+
areas.push(proxmox);
|
|
640
653
|
areas.push(
|
|
641
654
|
(async () => {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
const before = await text("proxmox", [...h.prefix, "updates"]);
|
|
645
|
-
// Host packages install on their own; a new Proxmox VE major is held by the entry script for the owner.
|
|
646
|
-
const upgrade = before !== null && pendingPackageLines(before).length > 0 ? await this.runEntry("proxmox", AUTO_CALLER, [...h.prefix, "host-upgrade"], HOST_UPGRADE_MS).catch((err) => (log(`daily: ${h.name} host-upgrade failed: ${err instanceof Error ? err.message : String(err)}`), null)) : undefined;
|
|
647
|
-
const updates = upgrade === undefined ? before : await text("proxmox", [...h.prefix, "updates"]);
|
|
648
|
-
hosts.push({ name: h.name, id: h.id, status: await text("proxmox", [...h.prefix, "host-status"]), updates, upgrade });
|
|
649
|
-
}
|
|
650
|
-
return proxmoxStatus(hosts);
|
|
651
|
-
})(),
|
|
652
|
-
);
|
|
653
|
-
areas.push(
|
|
654
|
-
(async () => {
|
|
655
|
+
// An upgrade of pve-cluster restarts it, and every guest read on that host fails meanwhile.
|
|
656
|
+
await proxmox;
|
|
655
657
|
const hosts: Record<string, string | null> = {};
|
|
656
658
|
// Guests one at a time: each call is an SSH session on the host.
|
|
657
659
|
for (const prefix of [[], ["space-x"]]) {
|