Repository navigation
(PA-9119) Diagnose dnf5 metadata staleness and fix versioncmp() truthiness bug - #851
Merged
Merged
Conversation
span786
marked this pull request as draft
August 18, 2026 16:15
span786
marked this pull request as ready for review
August 18, 2026 16:17
Contributor
|
@span786 I assume this is just for testing and can be closed? |
…iness bug The puppet8->puppet9 upgrade acceptance test failed deterministically on Fedora 41: Yumrepo[pc_repo] is created, then Package[puppet-agent] (ensure => latest) is managed in the same catalog run and finds no update, even though the newer build is published and reachable. Root cause is a dnf5 metadata-cache staleness bug in Puppet's dnf/yum package provider, fixed separately in puppet-private (PUP-12151). - Add failure diagnostics (repo/package state, the real --debug decision lines, dnf repolist/list output) so a recurrence is actionable from CI logs alone, without warming the cache the diagnostics are trying to observe and without raising on non-RPM platforms or when facter itself is broken (the exact scenario these diagnostics exist to capture). - Fix a versioncmp() truthiness bug in manifests/install.pp found during this investigation: versioncmp() returns an Integer, and Puppet treats every Integer (including 0 and negatives) as truthy, so `if versioncmp(...)` was true for every Fedora release, not just >= 41. Fedora releases below 41 were silently getting an unset package provider (relying on dnf auto-selection) instead of the intended explicit 'yum' provider. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
joshcooper
force-pushed
the
PA-9119/main/dnf5-metadata-refresh
branch
from
August 19, 2026 15:17
5d94536 to
5daa42c
Compare
joshcooper
approved these changes
Aug 19, 2026
joshcooper
approved these changes
Aug 19, 2026
Contributor
|
@span786 I merged the wrong PR initially, sorry about that. Still getting used to GH stacks |
3 tasks done
Contributor
Author
|
No worries! Opened a revert PR for the acceptance-test diagnostics added here (not needed now that the actual root cause is fixed in puppet-private#220) — the unrelated |
joshcooper
added a commit
that referenced
this pull request
Aug 19, 2026
Revert dnf5 upgrade-test diagnostics added in #851
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
acceptance/tests/test_upgrade_puppet8_to_puppet9.rbfailed deterministically on Fedora 41:Package[puppet-agent](ensure => 'latest') found no update immediately afterYumrepo['pc_repo']created the repo pointing at the newer puppet9-nightly build, in the same catalog run.Confirmed via a live failing build: Jenkins build #1, PLATFORM=fedora41-64default.
Tracked in PA-9119 and PUP-12151.
Root cause
A dnf5 metadata-cache staleness bug: dnf5's on-disk repo metadata cache can lag a repo that was created or changed earlier in the same Puppet transaction. PA-9119's investigation deterministically reproduced this (100% correlation across 6 trials tied to cache-warm-before-repo-exists), ruled out publish-lag, and pinned it to Puppet's
dnf/yumprovider never forcing a metadata refresh when checking for updates.The actual fix lives in
puppet-private: puppetlabs/puppet-private#217 (adds a dnf5-gated--refreshtocheck_updates/available_versions). This PR is the module-side half: better failure diagnostics for this class of bug, plus an unrelated bug found while investigating.What's in this PR
Acceptance test diagnostics (
test_upgrade_puppet8_to_puppet9.rb): on a post-upgrade version-assertion failure, log the repo/package state (the real--debugdecision lines,dnf repolist,dnf list --showduplicates) before teardown destroys the evidence, so a recurrence is diagnosable from CI logs alone. Guarded so it only runs on RPM-family agents (checked with a non-raisingtest -d /etc/yum.repos.d, notfacter/fact_on— this branch exists specifically for the case where the agent's facter is broken, andfact_onhas noaccept_all_exit_codesequivalent, so it would raise in exactly that scenario). Also fixed the pre-existingnil.match?crash risk:puppet_agent_version_onreturnsnil(not a non-matching string) whenfacter aio_agent_versionitself fails, which would otherwise raise before the diagnostics or even theassertcould run.manifests/install.ppbug fix: found during PA-9119's investigation —versioncmp()returns an Integer, and Puppet treats every Integer (including0and negatives) as truthy, so this was unconditionally true for every Fedora release, not just>= 41. Fixed toversioncmp(...) >= 0. This restores the pre-existing behavior for Fedora < 41 (explicit'yum'provider) that a recent change (d058ce3, introducing dnf5 handling for Fedora >= 41) unintentionally dropped for all Fedora releases. Added a regression test (spec/classes/puppet_agent_spec.rb) confirmed to fail against the buggy condition.Testing performed
bundle exec rake spec— 1135 examples, 0 failuresbundle exec rake lint/rake syntax/rake metadata_lint— cleanbundle exec rubocopon both modified Ruby files — cleaninstall.ppregression test fails against the pre-fixif versioncmp(...)condition (reverted, confirmed red, restored)Related
Base branch note: stacked on #847 (PA-8998, already open) since this test file's current state depends on it; the diff will narrow to just this PR's changes once #847 merges.
🤖 Generated with Claude Code