fix(ansible): surface run failure reason; widget audit cleanup
CI / lint (push) Successful in 2s
CI / unit (push) Successful in 7s
CI / integration (push) Successful in 2m17s
CI / publish (push) Successful in 1m1s

Run UX: when start_run throws before/around launch (e.g. ENOSPC creating the
temp dir — the box is out of disk), the run was marked "failed" with empty
output. Now the exception is broadcast + written to the run output/results so
the run view shows e.g. "[run error] OSError: [Errno 28] No space left on
device" instead of a blank failure.

Widget audit follow-ups (no broken links were found; these are consistency):
- host_resource_history widget now charts root (/) disk, consistent with the
  host panel (was the opaque "disk worst").
- host_resources widget: tooltip on the health dot explaining it warns on the
  worst mount while the number shows root.
- status_overview widget detail_url /status → /status/ (avoid redirect).
- Normalize ad-hoc widget empty-states to the shared .empty style (wording,
  which distinguishes "configured" vs "data yet", preserved).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 12:46:08 -04:00
parent 609bd78af2
commit e0253fba48
8 changed files with 27 additions and 14 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{# docker/widget.html — dashboard widget: container status overview #}
{% if not containers and running_count == 0 and stopped_count == 0 %}
<div style="color:var(--text-muted);font-size:0.85rem;padding:0.5rem 0;">No containers found.</div>
<p class="empty" style="padding:0.5rem 0;font-size:0.85rem;">No containers found.</p>
{% else %}
<div style="display:flex;gap:1rem;margin-bottom:0.65rem;">
+10 -5
View File
@@ -398,16 +398,21 @@ async def widget_history():
points = (await session.execute(
select(PluginMetric).where(
PluginMetric.source_module == SOURCE_MODULE,
PluginMetric.resource_name == host.name,
PluginMetric.metric_name.in_(
("cpu_pct", "mem_used_pct", "disk_used_pct_worst")),
PluginMetric.recorded_at >= cutoff,
or_(
and_(PluginMetric.resource_name == host.name,
PluginMetric.metric_name.in_(("cpu_pct", "mem_used_pct"))),
and_(PluginMetric.resource_name == host.name + ":/",
PluginMetric.metric_name == "disk_used_pct"),
),
).order_by(PluginMetric.recorded_at)
)).scalars().all()
series: dict[str, list[dict]] = {"cpu_pct": [], "mem_used_pct": [], "disk_used_pct_worst": []}
# Disk = root (/), consistent with the host panel — not the opaque "worst".
series: dict[str, list[dict]] = {"cpu_pct": [], "mem_used_pct": [], "disk_root": []}
for p in points:
series[p.metric_name].append({"t": p.recorded_at.isoformat(), "v": p.value})
key = "disk_root" if p.resource_name != host.name else p.metric_name
series[key].append({"t": p.recorded_at.isoformat(), "v": p.value})
return await render_template("widget_history.html", host=host, series=series, hours=hours)
@@ -9,9 +9,9 @@
type: "line",
data: {
datasets: [
{ label: "CPU %", data: series.cpu_pct.map(p => ({x: p.t, y: p.v})) },
{ label: "Mem %", data: series.mem_used_pct.map(p => ({x: p.t, y: p.v})) },
{ label: "Disk % worst", data: series.disk_used_pct_worst.map(p => ({x: p.t, y: p.v})) },
{ label: "CPU %", data: series.cpu_pct.map(p => ({x: p.t, y: p.v})) },
{ label: "Mem %", data: series.mem_used_pct.map(p => ({x: p.t, y: p.v})) },
{ label: "Disk / %", data: series.disk_root.map(p => ({x: p.t, y: p.v})) },
],
},
options: {
@@ -4,7 +4,8 @@
{% for r in rows %}
{% set stale = r.stale %}
<div style="display:flex;align-items:center;gap:0.6rem;font-size:0.82rem;padding:0.3rem 0;border-bottom:1px solid var(--border);">
<span class="dot {% if stale %}dot-dim{% elif (r.cpu_pct or 0) >= 90 or (r.mem_used_pct or 0) >= 90 or (r.disk_worst or 0) >= 90 %}dot-warn{% else %}dot-up{% endif %}"></span>
<span class="dot {% if stale %}dot-dim{% elif (r.cpu_pct or 0) >= 90 or (r.mem_used_pct or 0) >= 90 or (r.disk_worst or 0) >= 90 %}dot-warn{% else %}dot-up{% endif %}"
title="{% if stale %}stale / no recent data{% else %}warns at CPU/memory ≥90% or any disk mount ≥90% (the 'disk /' figure shows root only){% endif %}"></span>
<a href="/hosts/{{ r.host.id }}"
style="flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500;">
{{ r.host.name }}
@@ -1,6 +1,6 @@
{# unifi/widget_clients.html — dashboard widget: top active clients #}
{% if not snapshot %}
<div style="color:var(--text-muted);font-size:0.85rem;padding:0.5rem 0;">No client data yet.</div>
<p class="empty" style="padding:0.5rem 0;font-size:0.85rem;">No client data yet.</p>
{% else %}
<div style="display:flex;gap:1rem;margin-bottom:0.75rem;flex-wrap:wrap;">