Skip to content

Commit

Permalink
Add initial support for CentOS 9
Browse files Browse the repository at this point in the history
This is an attempt to introduce initial support for CentOS 9, and fixes
the missing gpg key file for CentOS 9.
  • Loading branch information
kajinamit committed Feb 7, 2022
1 parent 93c7500 commit 42e1252
Show file tree
Hide file tree
Showing 13 changed files with 186 additions and 7 deletions.
29 changes: 29 additions & 0 deletions files/RPM-GPG-KEY-EPEL-9
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBGE3mOsBEACsU+XwJWDJVkItBaugXhXIIkb9oe+7aadELuVo0kBmc3HXt/Yp
CJW9hHEiGZ6z2jwgPqyJjZhCvcAWvgzKcvqE+9i0NItV1rzfxrBe2BtUtZmVcuE6
2b+SPfxQ2Hr8llaawRjt8BCFX/ZzM4/1Qk+EzlfTcEcpkMf6wdO7kD6ulBk/tbsW
DHX2lNcxszTf+XP9HXHWJlA2xBfP+Dk4gl4DnO2Y1xR0OSywE/QtvEbN5cY94ieu
n7CBy29AleMhmbnx9pw3NyxcFIAsEZHJoU4ZW9ulAJ/ogttSyAWeacW7eJGW31/Z
39cS+I4KXJgeGRI20RmpqfH0tuT+X5Da59YpjYxkbhSK3HYBVnNPhoJFUc2j5iKy
XLgkapu1xRnEJhw05kr4LCbud0NTvfecqSqa+59kuVc+zWmfTnGTYc0PXZ6Oa3rK
44UOmE6eAT5zd/ToleDO0VesN+EO7CXfRsm7HWGpABF5wNK3vIEF2uRr2VJMvgqS
9eNwhJyOzoca4xFSwCkc6dACGGkV+CqhufdFBhmcAsUotSxe3zmrBjqA0B/nxIvH
DVgOAMnVCe+Lmv8T0mFgqZSJdIUdKjnOLu/GRFhjDKIak4jeMBMTYpVnU+HhMHLq
uDiZkNEvEEGhBQmZuI8J55F/a6UURnxUwT3piyi3Pmr2IFD7ahBxPzOBCQARAQAB
tCdGZWRvcmEgKGVwZWw5KSA8ZXBlbEBmZWRvcmFwcm9qZWN0Lm9yZz6JAk4EEwEI
ADgWIQT/itE0RZcQbs6BO5GKOHK/MihGfAUCYTeY6wIbDwULCQgHAgYVCgkICwIE
FgIDAQIeAQIXgAAKCRCKOHK/MihGfFX/EACBPWv20+ttYu1A5WvtHJPzwbj0U4yF
3zTQpBglQ2UfkRpYdipTlT3Ih6j5h2VmgRPtINCc/ZE28adrWpBoeFIS2YAKOCLC
nZYtHl2nCoLq1U7FSttUGsZ/t8uGCBgnugTfnIYcmlP1jKKA6RJAclK89evDQX5n
R9ZD+Cq3CBMlttvSTCht0qQVlwycedH8iWyYgP/mF0W35BIn7NuuZwWhgR00n/VG
4nbKPOzTWbsP45awcmivdrS74P6mL84WfkghipdmcoyVb1B8ZP4Y/Ke0RXOnLhNe
CfrXXvuW+Pvg2RTfwRDtehGQPAgXbmLmz2ZkV69RGIr54HJv84NDbqZovRTMr7gL
9k3ciCzXCiYQgM8yAyGHV0KEhFSQ1HV7gMnt9UmxbxBE2pGU7vu3CwjYga5DpwU7
w5wu1TmM5KgZtZvuWOTDnqDLf0cKoIbW8FeeCOn24elcj32bnQDuF9DPey1mqcvT
/yEo/Ushyz6CVYxN8DGgcy2M9JOsnmjDx02h6qgWGWDuKgb9jZrvRedpAQCeemEd
fhEs6ihqVxRFl16HxC4EVijybhAL76SsM2nbtIqW1apBQJQpXWtQwwdvgTVpdEtE
r4ArVJYX5LrswnWEQMOelugUG6S3ZjMfcyOa/O0364iY73vyVgaYK+2XtT2usMux
VL469Kj5m13T6w==
=Mjs/
-----END PGP PUBLIC KEY BLOCK-----
6 changes: 4 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"7",
"8"
"8",
"9"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7",
"8"
"8",
"9"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/usage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class { 'epel':
it_behaves_like 'an idempotent manifest'
it_behaves_like 'EPEL is available'

command = if fact('os.release.major') == '8'
command = if fact('os.release.major').to_i >= 8
'/usr/bin/yum-config-manager --dump epel'
else
'/usr/bin/yum-config-manager epel'
Expand Down Expand Up @@ -52,7 +52,7 @@ class { 'epel':
it_behaves_like 'an idempotent manifest'
it_behaves_like 'EPEL is available'

command = if fact('os.release.major') == '8'
command = if fact('os.release.major').to_i >= 8
'/usr/bin/yum-config-manager --dump epel'
else
'/usr/bin/yum-config-manager epel'
Expand Down
42 changes: 41 additions & 1 deletion spec/classes/epel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
supported_os: [
{
'operatingsystem' => 'RedHat',
'operatingsystemrelease' => %w[7 8]
'operatingsystemrelease' => %w[7 8 9]
}
]
}
Expand Down Expand Up @@ -96,6 +96,46 @@
it { is_expected.to contain_yumrepo('epel').with(mirrorlist: 'absent') }
end

context 'epel_username/password' do
let(:params) do
{
epel_username: 'user',
epel_password: 'password',
}
end

it { is_expected.to contain_yumrepo('epel').with(username: 'user') }
it { is_expected.to contain_yumrepo('epel').with(password: 'password') }
end
when '9'
it_behaves_like 'base 9'
it_behaves_like 'gpgkey 9'
it_behaves_like 'epel source 9'
it_behaves_like 'epel debuginfo 9'
it_behaves_like 'epel testing 9'
it_behaves_like 'epel testing source 9'
it_behaves_like 'epel testing debuginfo 9'
context 'epel_baseurl => https://example.com/epel/9/x86_64' do
let(:params) do
{
epel_baseurl: 'https://example.com/epel/9/x86_64'
}
end

it { is_expected.to contain_yumrepo('epel').with(baseurl: 'https://example.com/epel/9/x86_64') }
it { is_expected.to contain_yumrepo('epel').with(mirrorlist: 'absent') }
end

context 'epel_mirrorlist => absent' do
let(:params) do
{
epel_mirrorlist: 'absent'
}
end

it { is_expected.to contain_yumrepo('epel').with(mirrorlist: 'absent') }
end

context 'epel_username/password' do
let(:params) do
{
Expand Down
13 changes: 13 additions & 0 deletions spec/classes/shared_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
end
end

shared_examples_for 'base 9' do
include_context 'base'

it do
expect(subject).to contain_yumrepo('epel').with(
mirrorlist: 'https://mirrors.fedoraproject.org/metalink?repo=epel-9&arch=$basearch',
gpgkey: 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9',
descr: 'Extra Packages for Enterprise Linux 9 - $basearch',
failovermethod: 'absent'
)
end
end

shared_examples_for 'base 8' do
include_context 'base'

Expand Down
13 changes: 13 additions & 0 deletions spec/classes/shared_debuginfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
end
end

shared_examples_for 'epel debuginfo 9' do
include_context 'epel debuginfo'

it do
expect(subject).to contain_yumrepo('epel-debuginfo').with(
mirrorlist: 'https://mirrors.fedoraproject.org/metalink?repo=epel-debug-9&arch=$basearch',
gpgkey: 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9',
descr: 'Extra Packages for Enterprise Linux 9 - $basearch - Debug',
failovermethod: 'absent'
)
end
end

shared_examples_for 'epel debuginfo 8' do
include_context 'epel debuginfo'

Expand Down
19 changes: 19 additions & 0 deletions spec/classes/shared_gpgkey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

require 'spec_helper'

shared_examples_for 'gpgkey 9' do
it do
expect(subject).to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9').with(
ensure: 'file',
owner: 'root',
group: 'root',
mode: '0644'
)
expect(subject).to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9').
with_content(%r{BEGIN PGP PUBLIC KEY BLOCK})
end

it do
expect(subject).to contain_epel__rpm_gpg_key('EPEL-9').with(
path: '/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9'
)
end
end

shared_examples_for 'gpgkey 8' do
it do
expect(subject).to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8').with(
Expand Down
13 changes: 13 additions & 0 deletions spec/classes/shared_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
end
end

shared_examples_for 'epel source 9' do
include_context 'epel source'

it do
expect(subject).to contain_yumrepo('epel-source').with(
mirrorlist: 'https://mirrors.fedoraproject.org/metalink?repo=epel-source-9&arch=$basearch',
gpgkey: 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9',
descr: 'Extra Packages for Enterprise Linux 9 - $basearch - Source',
failovermethod: 'absent'
)
end
end

shared_examples_for 'epel source 8' do
include_context 'epel source'

Expand Down
13 changes: 13 additions & 0 deletions spec/classes/shared_testing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
end
end

shared_examples_for 'epel testing 9' do
include_context 'epel testing'

it do
expect(subject).to contain_yumrepo('epel-testing').with(
mirrorlist: 'https://mirrors.fedoraproject.org/metalink?repo=testing-epel9&arch=$basearch',
gpgkey: 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9',
descr: 'Extra Packages for Enterprise Linux 9 - Testing - $basearch',
failovermethod: 'absent'
)
end
end

shared_examples_for 'epel testing 8' do
include_context 'epel testing'

Expand Down
13 changes: 13 additions & 0 deletions spec/classes/shared_testing_debuginfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
end
end

shared_examples_for 'epel testing debuginfo 9' do
include_context 'epel testing debuginfo'

it do
expect(subject).to contain_yumrepo('epel-testing-debuginfo').with(
mirrorlist: 'https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel9&arch=$basearch',
gpgkey: 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9',
descr: 'Extra Packages for Enterprise Linux 9 - Testing - $basearch - Debug',
failovermethod: 'absent'
)
end
end

shared_examples_for 'epel testing debuginfo 8' do
include_context 'epel testing debuginfo'

Expand Down
13 changes: 13 additions & 0 deletions spec/classes/shared_testing_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
end
end

shared_examples_for 'epel testing source 9' do
include_context 'epel testing source'

it do
expect(subject).to contain_yumrepo('epel-testing-source').with(
mirrorlist: 'https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel9&arch=$basearch',
gpgkey: 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9',
descr: 'Extra Packages for Enterprise Linux 9 - Testing - $basearch - Source',
failovermethod: 'absent'
)
end
end

shared_examples_for 'epel testing source 8' do
include_context 'epel testing source'

Expand Down
13 changes: 12 additions & 1 deletion spec/defines/rpm_gpg_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
supported_os: [
{
'operatingsystem' => 'RedHat',
'operatingsystemrelease' => %w[7 8]
'operatingsystemrelease' => %w[7 8 9]
}
]
}
Expand Down Expand Up @@ -38,6 +38,17 @@
{ path: '/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8' }
end

when '9'
let :title do
'EPEL-9'
end
let :pre_condition do
'file { "/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9": }'
end
let :params do
{ path: '/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9' }
end

end
it do
expect(subject).to contain_exec("import-#{title}").with(
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

shared_examples 'EPEL is available' do
command = if fact('os.release.major') == '8'
command = if fact('os.release.major').to_i >= '8'
'/usr/bin/yum-config-manager --dump epel'
else
'/usr/bin/yum-config-manager epel'
Expand Down

0 comments on commit 42e1252

Please sign in to comment.