cs9: Fix URL for OpenStack packages

CentOS Stream 9 packages are hosted at mirror.stream.centos.org instead
of mirror.centos.org. Also the directory structure is a bit different
in the new mirror server.

Closes-Bug: #1978332
Change-Id: Ie8436a527fc308b70a7c3b34fb86a32604f836ff
This commit is contained in:
Takashi Kajinami 2022-06-11 01:17:46 +09:00
parent 351cd24276
commit 41f06f8f7b
4 changed files with 71 additions and 33 deletions

View File

@ -7,9 +7,11 @@ class openstack_extras::repo::redhat::params {
$release = 'yoga'
if versioncmp($::operatingsystemmajrelease, '9') >= 0 {
$manage_virt = false
$centos_mirror_url = 'http://mirror.stream.centos.org'
$manage_virt = false
} else {
$manage_virt = true
$centos_mirror_url = 'http://mirror.centos.org'
$manage_virt = true
}
$repo_defaults = {

View File

@ -63,7 +63,7 @@
#
# [*centos_mirror_url*]
# (Optional) URL of CentOS mirror.
# Defaults to 'http://mirror.centos.org'
# Defaults to $openstack_extras::repo::redhat::params::centos_mirror_url
#
# [*update_packages*]
# (Optional) Whether to update all packages after yum repositories are
@ -95,7 +95,7 @@ class openstack_extras::repo::redhat::redhat (
$gpgkey_defaults = {},
$purge_unmanaged = false,
$package_require = false,
$centos_mirror_url = 'http://mirror.centos.org',
$centos_mirror_url = $openstack_extras::repo::redhat::params::centos_mirror_url,
$update_packages = false,
$stream = true,
# DEPRECATED PARAMS
@ -131,9 +131,14 @@ class openstack_extras::repo::redhat::redhat (
if $manage_rdo {
$release_cap = capitalize($release)
$rdo_baseurl = $facts['os']['release']['major'] ? {
'9' => "${centos_mirror_url}/SIGs/${centos_major}/cloud/\$basearch/openstack-${release}/",
default => "${centos_mirror_url}/centos/${centos_major}/cloud/\$basearch/openstack-${release}/"
}
$rdo_hash = {
'rdo-release' => {
'baseurl' => "${centos_mirror_url}/centos/${centos_major}/cloud/\$basearch/openstack-${release}/",
'baseurl' => $rdo_baseurl,
'descr' => "OpenStack ${release_cap} Repository",
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud',
}

View File

@ -0,0 +1,5 @@
---
fixes:
- |
The ``openstack_extras::repos::redhat::redhat`` class now configures RDO
repository properly in CentOS Stream 9.

View File

@ -13,18 +13,6 @@ describe 'openstack_extras::repo::redhat::redhat' do
:before => 'Anchor[openstack_extras_redhat]',
)}
it { should contain_yumrepo('rdo-release').with(
:baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}-stream/cloud/$basearch/openstack-yoga/",
:descr => "OpenStack Yoga Repository",
:gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud',
:enabled => '1',
:gpgcheck => '1',
:mirrorlist => 'absent',
:module_hotfixes => true,
:notify => 'Exec[yum_refresh]',
:require => 'Anchor[openstack_extras_redhat]',
)}
it { should_not contain_file("/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-#{facts[:operatingsystemmajrelease]}") }
it { should_not contain_yumrepo('epel') }
@ -92,20 +80,6 @@ describe 'openstack_extras::repo::redhat::redhat' do
)}
end
context 'with overridden release' do
let :params do
{
:release => 'juno',
:manage_rdo => true,
}
end
it { should contain_yumrepo('rdo-release').with(
:baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}-stream/cloud/\$basearch/openstack-juno/",
:descr => 'OpenStack Juno Repository',
)}
end
context 'with overridden repo_hash and gpgkey_hash' do
let :params do
{
@ -208,6 +182,18 @@ describe 'openstack_extras::repo::redhat::redhat' do
context 'with default parameters' do
it { should contain_yumrepo('rdo-qemu-ev').with_ensure('absent') }
it { should contain_yumrepo('rdo-release').with(
:baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}-stream/cloud/$basearch/openstack-yoga/",
:descr => "OpenStack Yoga Repository",
:gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud',
:enabled => '1',
:gpgcheck => '1',
:mirrorlist => 'absent',
:module_hotfixes => true,
:notify => 'Exec[yum_refresh]',
:require => 'Anchor[openstack_extras_redhat]',
)}
it { should contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization').with(
:source => 'puppet:///modules/openstack_extras/RPM-GPG-KEY-CentOS-SIG-Virtualization',
:owner => 'root',
@ -229,6 +215,20 @@ describe 'openstack_extras::repo::redhat::redhat' do
)}
end
context 'with overridden release' do
let :params do
{
:release => 'juno',
:manage_rdo => true,
}
end
it { should contain_yumrepo('rdo-release').with(
:baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}-stream/cloud/\$basearch/openstack-juno/",
:descr => 'OpenStack Juno Repository',
)}
end
context 'with default parameters but puppetversion < 6.15.0' do
before do
facts.merge!( :puppetversion => '6.14.0' )
@ -380,6 +380,32 @@ describe 'openstack_extras::repo::redhat::redhat' do
it { should_not contain_yumrepo('rdo-qemu-ev') }
it { should_not contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization') }
it { should_not contain_yumrepo('centos-advanced-virt') }
it { should contain_yumrepo('rdo-release').with(
:baseurl => "http://mirror.stream.centos.org/SIGs/#{facts[:operatingsystemmajrelease]}-stream/cloud/$basearch/openstack-yoga/",
:descr => "OpenStack Yoga Repository",
:gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud',
:enabled => '1',
:gpgcheck => '1',
:mirrorlist => 'absent',
:module_hotfixes => true,
:notify => 'Exec[yum_refresh]',
:require => 'Anchor[openstack_extras_redhat]',
)}
end
context 'with overridden release' do
let :params do
{
:release => 'juno',
:manage_rdo => true,
}
end
it { should contain_yumrepo('rdo-release').with(
:baseurl => "http://mirror.stream.centos.org/SIGs/#{facts[:operatingsystemmajrelease]}-stream/cloud/$basearch/openstack-juno/",
:descr => 'OpenStack Juno Repository',
)}
end
context 'with stream is false' do
@ -391,7 +417,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
end
it { should contain_yumrepo('rdo-release').with(
:baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}/cloud/\$basearch/openstack-yoga/",
:baseurl => "http://mirror.stream.centos.org/SIGs/#{facts[:operatingsystemmajrelease]}/cloud/\$basearch/openstack-yoga/",
)}
end
@ -414,7 +440,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
end
it { should contain_yumrepo('rdo-release').with(
:baseurl => "http://foo.bar/centos/#{facts[:operatingsystemmajrelease]}-stream/cloud/\$basearch/openstack-yoga/",
:baseurl => "http://foo.bar/SIGs/#{facts[:operatingsystemmajrelease]}-stream/cloud/$basearch/openstack-yoga/",
)}
end