Decommission Homepage dashboard and update history hooks

This commit is contained in:
rope 2026-09-14 15:07:40 +01:00
parent 7145a35927
commit 02382f8446
10 changed files with 3 additions and 359 deletions

View file

@ -98,20 +98,7 @@ class Fixture(m.Deployment):
self.healthy()
def deploy(self, ident="a" * 32, flake="fixture", reboot=False):
with patch.object(
Path,
"exists",
autospec=True,
side_effect=lambda p: (
False
if str(p) == "/run/current-system/sw/bin/record-update"
else original_exists(p)
),
):
super().deploy(ident, flake, reboot)
original_exists = Path.exists
super().deploy(ident, flake, reboot)
class Transactions(unittest.TestCase):

View file

@ -443,17 +443,6 @@ class Deployment:
flush=True,
)
self.cleanup()
recorder = Path("/run/current-system/sw/bin/record-update")
if recorder.exists():
try:
self.command(
[str(recorder), record["old_running"], candidate], timeout=30
)
except Exception as error:
print(
f"Deployment committed; history recording failed: {error}",
flush=True,
)
if reboot:
components = ("kernel", "initrd", "kernel-modules")
if any(

View file

@ -1,41 +0,0 @@
#!/usr/bin/env bash
# Parse `nvd diff <old> <new>` output and write a JSON summary
# consumed by the Homepage dashboard's customapi widget.
set -euo pipefail
OLD="${1:-}"
NEW="${2:-/run/current-system}"
OUT_DIR="/var/lib/homepage-updates"
OUT_FILE="$OUT_DIR/latest.json"
if [ -z "$OLD" ]; then
echo "usage: record-update <old-system> [new-system]" >&2
exit 1
fi
mkdir -p "$OUT_DIR"
DIFF=$(nvd diff "$OLD" "$NEW" 2>&1 || true)
CHANGES=$(printf '%s\n' "$DIFF" | grep -cE '^\[[UAR][.*]\]' || true)
CLOSURE=$(printf '%s\n' "$DIFF" | grep -oE 'disk usage [+-][0-9.]+[A-Za-z]*B?' | head -1 | sed 's/disk usage //')
CLOSURE="${CLOSURE:-+0B}"
KERNEL=$(uname -r)
DATE=$(date '+%Y-%m-%d %H:%M')
if [ "$CHANGES" = "0" ]; then
LABEL="No changes"
else
LABEL="$CHANGES package changes"
fi
cat > "$OUT_FILE.tmp" <<EOF
{
"date": "$DATE",
"changes": "$LABEL",
"closure": "$CLOSURE",
"kernel": "$KERNEL"
}
EOF
mv "$OUT_FILE.tmp" "$OUT_FILE"