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>
This commit is contained in:
1 parent
ab962e1a90
commit
45af8bc1f8
5 files changed
+35
-14
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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
|
||||
'<div class="table-wrap"><table><thead><tr>'
|
||||
"<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>"
|
||||
)
|
||||
body = f'<main><div class="summary">{summary}</div>{table}</main>'
|
||||
@@ -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 (
|
||||
"<tr>"
|
||||
@@ -435,7 +443,8 @@ class Handler(BaseHTTPRequestHandler):
|
||||
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_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>{e(duration(r.get('uptime_seconds')))}</td>"
|
||||
f'<td title="{e(utc(h["received_at"]))}">{e(ago(h["received_at"], now))}</td>'
|
||||
|
||||
Reference in new issue
Block a user