Report a failed apt simulation instead of reading it as "no updates"
CI / tests (Python 3.10) (pull_request) Successful in 26s
CI / tests (Python 3.11) (pull_request) Successful in 25s
CI / tests (Python 3.12) (pull_request) Successful in 25s
CI / tests (Python 3.13) (pull_request) Successful in 25s
CI / lint (pull_request) Failing after 3s
CI / tests (Python 3.10) (pull_request) Successful in 26s
CI / tests (Python 3.11) (pull_request) Successful in 25s
CI / tests (Python 3.12) (pull_request) Successful in 25s
CI / tests (Python 3.13) (pull_request) Successful in 25s
CI / lint (pull_request) Failing after 3s
The agent ran `apt-get -s dist-upgrade 2>/dev/null || true`, so when apt failed (unmet dependencies, a broken sources entry, a damaged package cache) the empty output counted as zero updates and the host could show ok while nothing could be installed. The agent now keeps apt's exit status and stderr, reports apt_simulation_ok and the first "E:" line as apt_simulation_error, and sends the update counts as null. The server puts such a host in update with "apt can't work out pending updates: ...", and the host page shows the result. Agents before 0.5.0 don't send the field and are judged as before. Also show "–" rather than "None" for an unknown count in a host's history, and stop hard-coding the agent version in the status CLI tests. Agent 0.5.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1350c78676
commit
6d29197cfc
10 files changed
+100
-15
No files matched your search
@@ -198,6 +198,11 @@ def evaluate(received_at: int | None, report: dict[str, Any] | None, now: float,
|
||||
if livepatch_note and not covered:
|
||||
status.note(livepatch_note)
|
||||
|
||||
# An agent whose apt simulation failed sends no update counts, so "no security
|
||||
# updates" would be a guess. Agents before 0.5.0 don't send the field.
|
||||
if report.get("apt_simulation_ok") is False:
|
||||
why = report.get("apt_simulation_error") or "no error message"
|
||||
status.raise_to("update", f"apt can't work out pending updates: {why}")
|
||||
if kernels := report.get("kernel_upgradable"):
|
||||
status.raise_to("update", f"kernel update available: {', '.join(kernels)}")
|
||||
if sec := report.get("security_count"):
|
||||
|
||||
Reference in new issue
Block a user