fix: add dnf5 compatibility by extracting quiet_flags method#9577
Open
raman1236 wants to merge 1 commit intopuppetlabs:mainfrom
Open
fix: add dnf5 compatibility by extracting quiet_flags method#9577raman1236 wants to merge 1 commit intopuppetlabs:mainfrom
raman1236 wants to merge 1 commit intopuppetlabs:mainfrom
Conversation
dnf5 (default in Fedora 41+) removed the -d (debuglevel) and -e (errorlevel) flags, causing puppet package management to fail with: Unknown argument "-d" for command "dnf5" Extract the flag-building into a quiet_flags class method on the yum provider, then override it in the dnf provider to return an empty array. This preserves backward compatibility for yum while fixing dnf5. Also update dnfmodule provider to use quiet_flags instead of hardcoded flags. Fixes puppetlabs#9506
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.
Summary
Fixes #9506
The
dnfprovider fails on Fedora 41+ (which ships dnf5) because dnf5 removed the-d(debuglevel) and-e(errorlevel) flags:These flags were already deprecated in dnf4 (since CentOS 7 era).
Approach
Extract the flag-building into a
quiet_flagsclass method:quiet_flagsreturns['-d', '0', '-e', error_level]— preserving existing behaviorquiet_flagsreturns[]— compatible with both dnf4 and dnf5self.class.quiet_flagsThis follows the existing dnf provider pattern (inherit from yum, override class methods) and maintains full backward compatibility for yum.
Previous PRs
Fresh implementation addressing the same issue as #9520 and #9536 (both closed by author). Uses method extraction rather than removing flags entirely or adding version conditionals.
Files Changed
lib/puppet/provider/package/yum.rb— Addquiet_flagsmethod, use it ininstalllib/puppet/provider/package/dnf.rb— Overridequiet_flagsto return[]lib/puppet/provider/package/dnfmodule.rb— Replace hardcoded-d/-eflags withquiet_flags