Skip to content

Commit d058ce3

Browse files
committed
(PE-42492) Use dnf on fedora >= 41
On Fedora 41, `yum` is a symlink to dnf5, which doesn't accept -d: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y update puppet-agent-8.15.0.9.g6d2fce25b' returned 2: Unknown argument "-d" for command "dnf5". Add "--help" for more information about the arguments. Puppet's dnf provider was updated to support dnf5 in PA-7414, see puppetlabs/puppet-private@0d932d327ef, but that doesn't help if the provider is explicitly set to `yum`.
1 parent 306809a commit d058ce3

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

manifests/install.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@
9393
# any other type of source means we use a package manager (yum) with no 'source' parameter in the
9494
# package resource below
9595
$_package_version = $package_version
96-
$_provider = 'yum'
96+
if $facts['os']['name'] == 'Fedora' and versioncmp($facts['os']['release']['major'], '41') {
97+
$_provider = undef
98+
} else {
99+
$_provider = 'yum'
100+
}
97101
$_source = undef
98102
}
99103
}

spec/classes/puppet_agent_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,26 @@ def global_facts(facts, os)
119119
end
120120
end
121121

122+
context 'package provider' do
123+
# module is still pinned to older rspec-puppet and facterdb
124+
os_name = 'fedora-41-x86_64'
125+
os_facts = {
126+
os_name => on_supported_os['fedora-39-x86_64'],
127+
}
128+
os_facts.values.first[:os]['release'] = { 'full' => '41', 'major' => '41' }
129+
os_facts.each do |os, facts|
130+
context "on #{os}" do
131+
let(:facts) do
132+
global_facts(facts, os)
133+
end
134+
135+
let(:params) { { package_version: '6.18.0' } }
136+
137+
it { is_expected.to contain_package('puppet-agent').with_provider(nil) }
138+
end
139+
end
140+
end
141+
122142
context 'supported_operating systems' do
123143
on_supported_os.each do |os, facts|
124144
context "on #{os}" do

0 commit comments

Comments
 (0)