From d058ce388e2a239e29ce4ef6a36dab7724f922d8 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 29 Sep 2025 11:21:35 -0700 Subject: [PATCH 1/2] (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`. --- manifests/install.pp | 6 +++++- spec/classes/puppet_agent_spec.rb | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index eed05ca6..2a2988d8 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -93,7 +93,11 @@ # any other type of source means we use a package manager (yum) with no 'source' parameter in the # package resource below $_package_version = $package_version - $_provider = 'yum' + if $facts['os']['name'] == 'Fedora' and versioncmp($facts['os']['release']['major'], '41') { + $_provider = undef + } else { + $_provider = 'yum' + } $_source = undef } } diff --git a/spec/classes/puppet_agent_spec.rb b/spec/classes/puppet_agent_spec.rb index bdf47f1c..822e6608 100644 --- a/spec/classes/puppet_agent_spec.rb +++ b/spec/classes/puppet_agent_spec.rb @@ -119,6 +119,26 @@ def global_facts(facts, os) end end + context 'package provider' do + # module is still pinned to older rspec-puppet and facterdb + os_name = 'fedora-41-x86_64' + os_facts = { + os_name => on_supported_os['fedora-39-x86_64'], + } + os_facts.values.first[:os]['release'] = { 'full' => '41', 'major' => '41' } + os_facts.each do |os, facts| + context "on #{os}" do + let(:facts) do + global_facts(facts, os) + end + + let(:params) { { package_version: '6.18.0' } } + + it { is_expected.to contain_package('puppet-agent').with_provider(nil) } + end + end + end + context 'supported_operating systems' do on_supported_os.each do |os, facts| context "on #{os}" do From 44234afd42583c54cfc431d936c009e24b70c52b Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Mon, 29 Sep 2025 14:45:29 -0700 Subject: [PATCH 2/2] Pin to inifile module due to ruby 2.7 incompatibility https://github.com/puppetlabs/puppetlabs-inifile/commit/64aaa08e20066b306118fc55bf80a985fb558a57#diff-009cf0f832b3fccfa64213c7b2d0fb136df78deec09ac2a21b6d86d729ef3436R63 causes puppet_agent specs to fail on ruby 2.7: Evaluation Error: Error while evaluating a Resource Statement, Could not autoload puppet/type/ini_setting: /Users/runner/work/puppetlabs-puppet_agent/puppetlabs-puppet_agent/spec/fixtures/modules/inifile/lib/puppet/type/ini_setting.rb:63: syntax error, unexpected '}' ..., not '%{value}'") % { value: }) unless Puppet::Util.absolut... For now, pin to the most recently released version. --- .fixtures.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.fixtures.yml b/.fixtures.yml index 1c744c9a..f83777e7 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,6 +2,8 @@ fixtures: repositories: stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git apt: https://github.com/puppetlabs/puppetlabs-apt.git - inifile: https://github.com/puppetlabs/puppetlabs-inifile.git + inifile: + repo: https://github.com/puppetlabs/puppetlabs-inifile.git + ref: "v6.2.0" yumrepo_core: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git facts: https://github.com/puppetlabs/puppetlabs-facts.git