fix(system_baseline): do not report a pending package upgrade as drift in check mode #323

Merged
Defame1297 merged 2 commits from fix/321-system-baseline-check-mode into main 2026-11-23 18:09:58 +00:00
Collaborator

What and why

Closes #321

A scheduled dry run (--check) of a play that includes system_baseline reported every host as changed whenever a package was waiting for the next patch run, or the apt cache was older than an hour, because the package module reports both as changed in check mode. In the main flow the role now skips the apt upgrade in check mode. Autoremove and autoclean are a task of their own and stay checked, so a leftover package still shows as drift.

The tasks_from: update entry point is a supported interface (its behaviour follows semver), so it is left as it was: it still previews the upgrade in check mode. Only tasks/main.yml sets the internal __system_baseline_main_flow that makes the skip apply.

Behaviour changes

  • In the main flow, check mode no longer previews the upgrade (the issue's proposal). If you would rather keep the preview available, a variable instead of the hard skip is an easy change; the issue asks that and has no answer yet.
  • apt-get autoclean now runs. In the old single call the module ran the upgrade first and did not reach autoclean (read from the apt module source), so splitting the task makes autoclean run for the first time, in the main flow and in the update entry point. A host with stale archives reports changed once for it.

Verified

  • The condition and the variable passing, with Ansible's own engine and the real update.yml (package module stubbed): in a real run both tasks run in the main flow and in the entry point; in --check the main flow skips only the upgrade, and the entry point still runs it. system_baseline_update: false and --skip-tags update still skip both tasks.
  • All commit-stage hooks pass (yamllint, ansible-lint, REUSE, changelog lint, Conventional Commit).
  • An independent review of the diff, no blocking finding; its wording findings are applied.

Not verified

  • Molecule: the scenario skips the update tag (no privileged container), so neither task runs in CI and this change has no automated coverage.
  • A real apt host: I did not run the split tasks against one, so the idempotence of the cleanup task (changed only when apt reports Del or packages to remove) is read from the module, not observed.

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.

Assisted-by: Claude Code

## What and why Closes #321 A scheduled dry run (`--check`) of a play that includes `system_baseline` reported every host as changed whenever a package was waiting for the next patch run, or the apt cache was older than an hour, because the package module reports both as `changed` in check mode. In the main flow the role now skips the apt upgrade in check mode. Autoremove and autoclean are a task of their own and stay checked, so a leftover package still shows as drift. The `tasks_from: update` entry point is a supported interface (its behaviour follows semver), so it is left as it was: it still previews the upgrade in check mode. Only `tasks/main.yml` sets the internal `__system_baseline_main_flow` that makes the skip apply. **Behaviour changes** - In the main flow, check mode no longer previews the upgrade (the issue's proposal). If you would rather keep the preview available, a variable instead of the hard skip is an easy change; the issue asks that and has no answer yet. - `apt-get autoclean` now runs. In the old single call the module ran the upgrade first and did not reach autoclean (read from the apt module source), so splitting the task makes autoclean run for the first time, in the main flow and in the `update` entry point. A host with stale archives reports `changed` once for it. ## Verified - The condition and the variable passing, with Ansible's own engine and the real `update.yml` (package module stubbed): in a real run both tasks run in the main flow and in the entry point; in `--check` the main flow skips only the upgrade, and the entry point still runs it. `system_baseline_update: false` and `--skip-tags update` still skip both tasks. - All commit-stage hooks pass (yamllint, ansible-lint, REUSE, changelog lint, Conventional Commit). - An independent review of the diff, no blocking finding; its wording findings are applied. ## Not verified - Molecule: the scenario skips the `update` tag (no privileged container), so neither task runs in CI and this change has no automated coverage. - A real apt host: I did not run the split tasks against one, so the idempotence of the cleanup task (changed only when apt reports `Del ` or packages to remove) is read from the module, not observed. --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. Assisted-by: Claude Code
Dragonish added 1 commit 2026-11-23 17:55:58 +00:00
fix(system_baseline): do not report a pending package upgrade as drift in check mode
Build / build (pull_request) Successful in 17s
Molecule / molecule (pull_request) Successful in 1m52s
Lint / lint (pull_request) Successful in 2m8s
55bd5d5231
The main flow skips the apt upgrade in check mode; autoremove and
autoclean are a task of their own and stay checked. The update entry
point is unchanged and still previews the upgrade.

Assisted-by: Claude Code
Defame1297 approved these changes 2026-11-23 17:59:20 +00:00
Defame1297 added 1 commit 2026-11-23 18:05:03 +00:00
Merge branch 'main' into fix/321-system-baseline-check-mode
Build / build (pull_request) Successful in 18s
Lint / lint (pull_request) Successful in 2m50s
Molecule / molecule (pull_request) Successful in 1m38s
637a297e00
Defame1297 merged commit 9b968e1e71 into main 2026-11-23 18:09:58 +00:00
Defame1297 deleted branch fix/321-system-baseline-check-mode 2026-11-23 18:09:58 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#323