Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## 0.3.1 (unreleased)

- **Fixed: `Obsoleting Packages` rows were counted as pending updates on yum (and on dnf when the replaced row had a dot).**
`yum -q check-update` and `dnf -q check-update` print an `Obsoleting Packages` section after the real updates; its rows are
replacements, not updates. The yum filter kept every row of three or more fields, so both the replacing package and the
indented replaced package were counted: `available` and `package_count` were too high, both rows appeared in
`packages[]`, and `security` could include them. The dnf filter dropped only the header, so the
indented replaced row still got through. Both branches now stop reading at the `Obsoleting Packages` header.
- **Correction to the 0.3.0 notes: the Windows fact changed shape, and the "keeps working" statement below does not hold for
Windows readers.** The 0.3.0 entry says a version 1 reader keeps working and that everything else is additive. That is true
of the Linux fact. On Windows, `facts.d/patchbot.ps1` no longer emits the `patches[]` array (`{"id","severity","security"}`)
that 0.2.0 and earlier emitted. Anything that read `patches[]` on Windows nodes (PuppetDB queries, third-party reporting)
must move to `missing[]`:
- `patches[]` is replaced by `missing[]`, one entry per missing update with `kbs` (an array of KB numbers), `title`,
`severity` (the raw MSRC severity string, or null; no longer folded into low/medium/high/unknown), `cve_ids` and
`reboot`. An update with no KB has an empty `kbs` array; it is no longer keyed by its Windows Update GUID.
- `os_build` (four-part build, for example `10.0.20348.3328`) and `installed_kbs` (sorted array of installed KB numbers) are
added, along with `source`, `wsus_server`, `cve_ids_populated` and `scan_error`.
- `cache_age_seconds` (always `0`) and `cache_stale` (always `false`) are added. The Windows fact scans the Windows Update
Agent live on every run, as it did before; there is no cache to age.
- `security` on Windows is now the number of missing updates whose MSRC severity is set and not `Unspecified`, counted over the
whole scan. It used to also count any update in the `Security Updates` category.
- `reboot_required` is now derived from the four reboot probes, not from the Windows Update `SystemInfo.RebootRequired` flag.
- `facts.d/patchbot.sh` is again a byte-identical copy of the development copy kept in the Puppet Stagehand Console repository.
sha256: `patchbot.sh` `73fa520357f3e1857ae6fb30534c8876141b9fcf602e96c2a542efd2a49f94cd`. `facts.d/patchbot.ps1` is unchanged from
0.3.0.

## [0.3.0] - 2026-11-18

0.2.0 was never tagged or released, and 0.3.0 is the first release that carries it: everything under 0.2.0 below ships in 0.3.0
Expand Down Expand Up @@ -52,6 +79,8 @@ too.
boolean survives.
- The Windows fact (`facts.d/patchbot.ps1`) is unaffected — it keeps its own
legacy `patches[]`-shaped KB-entry array.
(Superseded in 0.3.0: the Windows fact no longer emits `patches[]`. See the
0.3.1 notes above for the replacement `missing[]` shape.)

## [0.1.0] - 2026-08-20

Expand Down
25 changes: 14 additions & 11 deletions facts.d/patchbot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,12 @@ elif command -v dnf >/dev/null 2>&1; then
# check-update never reports what's currently installed, so the batched
# rpm_installed_versions lookup below is what makes `current` true
# (D-02, spec S4). NF>=3 drops a wrapped two-line check-update entry (a
# pre-existing limitation this plan does not change). The LIST filter is the
# adapters copy's (D-06): it also drops a `Last metadata expiration` line and
# any row whose first field has no dot, so a `replacing` row under
# Obsoleting Packages is never counted as an update.
# pre-existing limitation this plan does not change). The LIST filter also
# drops a `Last metadata expiration` line and any row whose first field has
# no dot, and it stops reading at an `Obsoleting Packages` header: every row
# under that header (the replacing package and its indented replaced
# package) is a replacement, not a pending update, and the replaced row has
# a dot and three fields, so a per-row test alone would count it.
MANAGER="dnf"
# Capture the exit codes the old pipelines discarded: `check-update` exits 0 with nothing pending, 100 with updates pending, and
# anything else when it could not run (AlmaLinux 8.10 exits 1 when repo metadata is unreachable). Without this a failed check
Expand All @@ -364,7 +366,7 @@ elif command -v dnf >/dev/null 2>&1; then
0|100) ;;
*) STATUS=check_failed; CHECK_ERROR=metadata_unavailable ;;
esac
LIST=$(printf '%s\n' "$CHECK_OUT" | awk 'NF>=3 && $1 !~ /^Obsoleting/ && $1 !~ /^Last/ && $1 ~ /\./ {print}' || true)
LIST=$(printf '%s\n' "$CHECK_OUT" | awk '/^Obsoleting/ {exit} NF>=3 && $1 !~ /^Last/ && $1 ~ /\./ {print}' || true)
# Security advisories name their packages as full NEVRA, one row per advisory per package build. If this lookup fails the update
# list is real but every security flag would silently be false, so a failure here fails the whole check too.
SEC_OUT=$(dnf -q updateinfo list security --available 2>/dev/null)
Expand Down Expand Up @@ -441,13 +443,14 @@ elif command -v yum >/dev/null 2>&1; then
# Same shape as the dnf branch above, reusing rpm_installed_versions,
# rpm_installed_version_for, pkgname_is_safe, add_package, json_escape and
# the shared exact-name rule (security_names, counted once per pending
# update over the whole list) rather than duplicating any of them. Every
# yum-specific difference from the dnf branch stays intact: its own LIST
# filter (no Obsoleting guard), `yum -q updateinfo list security` without
# --available, and the bare needs-restarting reboot probe (not
# `yum -q needs-restarting`).
# update over the whole list) rather than duplicating any of them. The
# yum-specific differences from the dnf branch are: `yum -q updateinfo list
# security` without --available, and the bare needs-restarting reboot probe
# (not `yum -q needs-restarting`). The LIST filter is the same as dnf's: yum
# prints the same `Obsoleting Packages` section, whose rows are replacements,
# not pending updates, so reading stops at its header.
MANAGER="yum"
LIST=$(yum -q check-update 2>/dev/null | awk 'NF>=3 {print}' || true)
LIST=$(yum -q check-update 2>/dev/null | awk '/^Obsoleting/ {exit} NF>=3 && $1 !~ /^Last/ && $1 ~ /\./ {print}' || true)
# The exact names the advisories name, and the count of pending updates among them: never advisory rows (see the dnf branch).
SECNAMES=$(yum -q updateinfo list security 2>/dev/null | security_names)
SEC_COUNT=0
Expand Down
Loading