From 45af8bc1f8c4f3dfe1ebadca9ba9fb8063ee9f98 Mon Sep 17 00:00:00 2001 From: patrick Date: Sat, 17 Oct 2026 13:09:15 -0400 Subject: [PATCH] Give phased updates their own dashboard column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "+N phased" suffix in the Updates cell was easy to miss and only appeared when something was deferred. Add a Phased column instead: the count (hover for the packages), "0" when nothing is deferred, "–" on distributions that don't phase (Debian), "?" for agents too old to report it. Dashboard-only; no agent redeploy needed. Server 0.3.1. Also list Ubuntu 26.04 as tested in the agent installer and README (already reporting fine from a 26.04 host). Co-Authored-By: Claude Opus 5.5 --- README.md | 5 +++-- agent/install.sh | 2 +- server/kernelwatch/__init__.py | 2 +- server/kernelwatch/web.py | 25 +++++++++++++++++-------- tests/test_web.py | 15 +++++++++++++-- 5 files changed, 35 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 25e4f3d..ced82d6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ fleet is running its newest kernel, has updates waiting, or needs a reboot. ingest API and a login-protected dashboard. You don't need pip, a venv or a build step. -Supported: agents on **Debian 12/13** and **Ubuntu 22.04/24.04 LTS**; server on +Supported: agents on **Debian 12/13** and **Ubuntu 22.04/24.04/26.04 LTS**; server on **Debian 12+** or **Ubuntu 22.04+** (the system `python3`, 3.10 or newer). ``` @@ -66,7 +66,8 @@ How the agent works it out: - **Phased updates** (Ubuntu only): Ubuntu rolls some updates out gradually and holds them back from a share of machines at first. apt doesn't offer these to the host yet, so they aren't counted as available updates. They appear as - `+N phased` in the Updates column, with the package list on the host page. + their own Phased column (hover for the packages, `–` on Debian), with the + list also on the host page. They never affect status, because Ubuntu doesn't phase security updates and there's nothing to act on until apt offers them. - **Package list freshness**: the mtime of apt's update stamps. The agent diff --git a/agent/install.sh b/agent/install.sh index 85493dd..19dbeb0 100755 --- a/agent/install.sh +++ b/agent/install.sh @@ -36,7 +36,7 @@ done # shellcheck source=/dev/null . /etc/os-release case "$ID:$VERSION_ID" in -debian:12 | debian:13 | ubuntu:22.04 | ubuntu:24.04) ;; +debian:12 | debian:13 | ubuntu:22.04 | ubuntu:24.04 | ubuntu:26.04) ;; *) echo "warning: untested OS $PRETTY_NAME; continuing" >&2 ;; esac diff --git a/server/kernelwatch/__init__.py b/server/kernelwatch/__init__.py index 419fc53..54cddf9 100644 --- a/server/kernelwatch/__init__.py +++ b/server/kernelwatch/__init__.py @@ -1,6 +1,6 @@ """kernelwatch: fleet kernel and reboot status dashboard.""" -__version__ = "0.3.0" +__version__ = "0.3.1" # Version of agent/kernelwatch-agent shipped alongside this server; older agents # are noted on the dashboard. tests/test_status.py checks the two stay in sync. diff --git a/server/kernelwatch/web.py b/server/kernelwatch/web.py index f2010b0..89c238d 100644 --- a/server/kernelwatch/web.py +++ b/server/kernelwatch/web.py @@ -84,6 +84,19 @@ def utc(ts: float | None) -> str: return time.strftime("%Y-%m-%d %H:%M:%S UTC", time.gmtime(ts)) if ts else "" +def phased_summary(report: dict[str, Any]) -> tuple[str, str]: + """(short cell text, full description) for updates deferred by Ubuntu's phasing.""" + if report.get("os_id") not in (None, "ubuntu"): + return "–", "this distribution doesn't phase updates" + pkgs = report.get("phased_packages") + if pkgs is None: + return "?", "unknown: agent too old to report phased updates" + if not pkgs: + return "0", "none deferred" + return str(len(pkgs)), ("held back by Ubuntu's phased rollout, not offered to this host " + "yet (never security updates): " + ", ".join(pkgs)) + + def services_summary(report: dict[str, Any]) -> tuple[str, str]: """(short cell text, full description) for services needing a restart.""" services = report.get("services_need_restart") @@ -407,7 +420,7 @@ class Handler(BaseHTTPRequestHandler): if not hosts else '
' "" - "" + "" "" + "".join(rows) + "
StatusHostOSRunning kernelNewest installedUpdatesServicesUptimeLast seenNewest installedUpdatesPhasedServicesUptimeLast seenDetails
" ) body = f'
{summary}
{table}
' @@ -420,13 +433,8 @@ class Handler(BaseHTTPRequestHandler): name = h["host"] sec = r.get("security_count") total = r.get("upgradable_count") - phased = len(r.get("phased_packages") or []) updates = "–" if total is None else f"{total}" + (f" ({sec} sec)" if sec else "") - updates_title = "" - if phased: - updates += f" +{phased} phased" - updates_title = (f"{phased} more held back by Ubuntu's phased rollout: not offered to " - "this host yet, never security updates") + phased = phased_summary(r) services = services_summary(r) return ( "" @@ -435,7 +443,8 @@ class Handler(BaseHTTPRequestHandler): f"{e(r.get('os_pretty_name') or '–')}" f"{e(r.get('kernel_running') or '–')}" f"{e(r.get('kernel_newest_installed') or '–')}" - f'{e(updates)}' + f"{e(updates)}" + f'{e(phased[0])}' f'{e(services[0])}' f"{e(duration(r.get('uptime_seconds')))}" f'{e(ago(h["received_at"], now))}' diff --git a/tests/test_web.py b/tests/test_web.py index 1c3b981..b716b00 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -91,6 +91,14 @@ class IngestTest(ServerCase): self.assertEqual(status, 413) +class PhasedSummaryTest(unittest.TestCase): + def test_cells(self): + self.assertEqual(web.phased_summary({"os_id": "debian", "phased_packages": []})[0], "–") + self.assertEqual(web.phased_summary({"os_id": "ubuntu"})[0], "?") + self.assertEqual(web.phased_summary({"os_id": "ubuntu", "phased_packages": []})[0], "0") + self.assertEqual(web.phased_summary({"os_id": "ubuntu", "phased_packages": ["a", "b"]})[0], "2") + + class DashboardTest(ServerCase): def test_requires_login(self): for path in ("/", "/host/web01"): @@ -124,7 +132,7 @@ class DashboardTest(ServerCase): self.add_host("db01") # never reports self.post_report(token, {"kernel_running": "6.8.0-85-generic", "kernel_newest_installed": "6.8.0-87-generic", - "os_pretty_name": "Ubuntu 24.04.3 LTS ", + "os_pretty_name": "Ubuntu 24.04.3 LTS ", "os_id": "ubuntu", "apt_lists_age_seconds": 60, "agent_version": "0.1.0", "services_need_restart": ["nginx.service"], @@ -145,7 +153,10 @@ class DashboardTest(ServerCase): self.assertIn("never reported", body) self.assertIn("1 service needs restart: nginx", body) self.assertIn("agent 0.1.0 is older", body) - self.assertIn("2 (1 sec) +3 phased", body) + self.assertIn("Phased", body) + self.assertIn("2 (1 sec)", body) + self.assertIn('held back by Ubuntu's phased rollout, not offered to this host yet ' + '(never security updates): systemd, udev, libudev1">3', body) web01_reasons = body[body.rindex(''):].split("")[0] # last row self.assertIn("security update", web01_reasons) self.assertNotIn("phas", web01_reasons, "phasing is never a status reason") -- 2.54.1