Compare commits

..
2 Commits
Author SHA1 Message Date
patrick 7a8c51ec84 Merge pull request 'Give phased updates their own dashboard column' (#4) from feature/phased-column into main
Reviewed-on: #4
2026-10-17 17:09:42 +00:00
patrickandClaude Opus 5.5 45af8bc1f8 Give phased updates their own dashboard column
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 <noreply@anthropic.com>
2026-10-17 13:09:15 -04:00
5 changed files with 35 additions and 14 deletions

No files matched your search

+3 -2
View File
@@ -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 ingest API and a login-protected dashboard. You don't need pip, a venv or a
build step. 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). **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 - **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 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 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 They never affect status, because Ubuntu doesn't phase security updates and
there's nothing to act on until apt offers them. there's nothing to act on until apt offers them.
- **Package list freshness**: the mtime of apt's update stamps. The agent - **Package list freshness**: the mtime of apt's update stamps. The agent
+1 -1
View File
@@ -36,7 +36,7 @@ done
# shellcheck source=/dev/null # shellcheck source=/dev/null
. /etc/os-release . /etc/os-release
case "$ID:$VERSION_ID" in 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 ;; *) echo "warning: untested OS $PRETTY_NAME; continuing" >&2 ;;
esac esac
+1 -1
View File
@@ -1,6 +1,6 @@
"""kernelwatch: fleet kernel and reboot status dashboard.""" """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 # 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. # are noted on the dashboard. tests/test_status.py checks the two stay in sync.
+17 -8
View File
@@ -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 "" 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]: def services_summary(report: dict[str, Any]) -> tuple[str, str]:
"""(short cell text, full description) for services needing a restart.""" """(short cell text, full description) for services needing a restart."""
services = report.get("services_need_restart") services = report.get("services_need_restart")
@@ -407,7 +420,7 @@ class Handler(BaseHTTPRequestHandler):
if not hosts else if not hosts else
'<div class="table-wrap"><table><thead><tr>' '<div class="table-wrap"><table><thead><tr>'
"<th>Status</th><th>Host</th><th>OS</th><th>Running kernel</th>" "<th>Status</th><th>Host</th><th>OS</th><th>Running kernel</th>"
"<th>Newest installed</th><th>Updates</th><th>Services</th><th>Uptime</th><th>Last seen</th>" "<th>Newest installed</th><th>Updates</th><th>Phased</th><th>Services</th><th>Uptime</th><th>Last seen</th>"
"<th>Details</th></tr></thead><tbody>" + "".join(rows) + "</tbody></table></div>" "<th>Details</th></tr></thead><tbody>" + "".join(rows) + "</tbody></table></div>"
) )
body = f'<main><div class="summary">{summary}</div>{table}</main>' body = f'<main><div class="summary">{summary}</div>{table}</main>'
@@ -420,13 +433,8 @@ class Handler(BaseHTTPRequestHandler):
name = h["host"] name = h["host"]
sec = r.get("security_count") sec = r.get("security_count")
total = r.get("upgradable_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 = "–" if total is None else f"{total}" + (f" ({sec} sec)" if sec else "")
updates_title = "" phased = phased_summary(r)
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")
services = services_summary(r) services = services_summary(r)
return ( return (
"<tr>" "<tr>"
@@ -435,7 +443,8 @@ class Handler(BaseHTTPRequestHandler):
f"<td>{e(r.get('os_pretty_name') or '–')}</td>" f"<td>{e(r.get('os_pretty_name') or '–')}</td>"
f"<td><code>{e(r.get('kernel_running') or '–')}</code></td>" f"<td><code>{e(r.get('kernel_running') or '–')}</code></td>"
f"<td><code>{e(r.get('kernel_newest_installed') or '–')}</code></td>" f"<td><code>{e(r.get('kernel_newest_installed') or '–')}</code></td>"
f'<td title="{e(updates_title)}">{e(updates)}</td>' f"<td>{e(updates)}</td>"
f'<td title="{e(phased[1])}">{e(phased[0])}</td>'
f'<td title="{e(services[1])}">{e(services[0])}</td>' f'<td title="{e(services[1])}">{e(services[0])}</td>'
f"<td>{e(duration(r.get('uptime_seconds')))}</td>" f"<td>{e(duration(r.get('uptime_seconds')))}</td>"
f'<td title="{e(utc(h["received_at"]))}">{e(ago(h["received_at"], now))}</td>' f'<td title="{e(utc(h["received_at"]))}">{e(ago(h["received_at"], now))}</td>'
+13 -2
View File
@@ -91,6 +91,14 @@ class IngestTest(ServerCase):
self.assertEqual(status, 413) 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): class DashboardTest(ServerCase):
def test_requires_login(self): def test_requires_login(self):
for path in ("/", "/host/web01"): for path in ("/", "/host/web01"):
@@ -124,7 +132,7 @@ class DashboardTest(ServerCase):
self.add_host("db01") # never reports self.add_host("db01") # never reports
self.post_report(token, {"kernel_running": "6.8.0-85-generic", self.post_report(token, {"kernel_running": "6.8.0-85-generic",
"kernel_newest_installed": "6.8.0-87-generic", "kernel_newest_installed": "6.8.0-87-generic",
"os_pretty_name": "Ubuntu 24.04.3 LTS <b>", "os_pretty_name": "Ubuntu 24.04.3 LTS <b>", "os_id": "ubuntu",
"apt_lists_age_seconds": 60, "apt_lists_age_seconds": 60,
"agent_version": "0.1.0", "agent_version": "0.1.0",
"services_need_restart": ["nginx.service"], "services_need_restart": ["nginx.service"],
@@ -145,7 +153,10 @@ class DashboardTest(ServerCase):
self.assertIn("never reported", body) self.assertIn("never reported", body)
self.assertIn("1 service needs restart: nginx", body) self.assertIn("1 service needs restart: nginx", body)
self.assertIn("agent 0.1.0 is older", body) self.assertIn("agent 0.1.0 is older", body)
self.assertIn("2 (1 sec) +3 phased", body) self.assertIn("<th>Phased</th>", body)
self.assertIn("<td>2 (1 sec)</td>", body)
self.assertIn('held back by Ubuntu&#x27;s phased rollout, not offered to this host yet '
'(never security updates): systemd, udev, libudev1">3</td>', body)
web01_reasons = body[body.rindex('<td class="reasons">'):].split("</td>")[0] # last row web01_reasons = body[body.rindex('<td class="reasons">'):].split("</td>")[0] # last row
self.assertIn("security update", web01_reasons) self.assertIn("security update", web01_reasons)
self.assertNotIn("phas", web01_reasons, "phasing is never a status reason") self.assertNotIn("phas", web01_reasons, "phasing is never a status reason")