Skip to content

Commit

Permalink
Add Support for r10k 4 & 5
Browse files Browse the repository at this point in the history
r10k 5 requires Ruby 3.1 or Puppet 8.
  • Loading branch information
bastelfreak committed Dec 11, 2024
1 parent 6edc75d commit 29ba4e5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
9 changes: 8 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
'OpenBSD' => 'ruby31-r10k',
default => 'r10k'
}
$version = 'installed'
# 4.1.0 is the oldest version that supports ruby >=2.6.0
# That's required on Puppet 7
# pacman provider has no versionable flag
$version = if versioncmp($facts['puppetversion'], '8.0.0') < 0 and $facts['os']['name'] != 'Archlinux' {
'4.1.0'
} else {
'installed'
}
$manage_modulepath = false
$root_user = 'root'
$root_group = 'root'
Expand Down
32 changes: 32 additions & 0 deletions spec/acceptance/r10k_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'r10k tests' do
context 'when defaults used' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
include 'r10k'
PUPPET
end
end

describe package('r10k') do
it { is_expected.to be_installed }
end

describe command('r10k version') do
its(:stdout) { is_expected.to match(%r{r10k 4}) } if fact('puppetversion')[0] == '7'
its(:exit_status) { is_expected.to eq 0 }
end

describe file('//etc/puppetlabs/r10k/r10k.yaml') do
it 'exists and has content' do
expect(subject).to exist
expect(subject).to be_owned_by 'root'
expect(subject).to be_grouped_into 'root'
end
end
end
end

0 comments on commit 29ba4e5

Please sign in to comment.