Skip to content

fix: add dnf5 compatibility by extracting quiet_flags method#9577

Open
raman1236 wants to merge 1 commit intopuppetlabs:mainfrom
raman1236:fix/dnf5-remove-deprecated-flags
Open

fix: add dnf5 compatibility by extracting quiet_flags method#9577
raman1236 wants to merge 1 commit intopuppetlabs:mainfrom
raman1236:fix/dnf5-remove-deprecated-flags

Conversation

@raman1236
Copy link
Copy Markdown

Summary

Fixes #9506

The dnf provider fails on Fedora 41+ (which ships dnf5) because dnf5 removed the -d (debuglevel) and -e (errorlevel) flags:

Unknown argument "-d" for command "dnf5". Add "--help" for more information about the arguments.

These flags were already deprecated in dnf4 (since CentOS 7 era).

Approach

Extract the flag-building into a quiet_flags class method:

  • yum provider: quiet_flags returns ['-d', '0', '-e', error_level] — preserving existing behavior
  • dnf provider: quiet_flags returns [] — compatible with both dnf4 and dnf5
  • dnfmodule provider: Updated all command invocations to use self.class.quiet_flags

This 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 — Add quiet_flags method, use it in install
  • lib/puppet/provider/package/dnf.rb — Override quiet_flags to return []
  • lib/puppet/provider/package/dnfmodule.rb — Replace hardcoded -d/-e flags with quiet_flags

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
@raman1236 raman1236 requested a review from a team as a code owner April 5, 2026 17:28
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 5, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

puppet agent not working with dnf5

3 participants