CentOS: Allow fixing repository url for CentOS Stream

URL of SIG repository is different between CentOS and CentOS Stream.
('-stream' prefixes major version)

This change introduces the `stream` parameter which we already added
to openstack_extras so that users can use the correct repository
without defining the whole url by ceph_mirror.

Change-Id: Ibfb4cc4df52cd1318a5497e2ea02c2ca0893331f
This commit is contained in:
Takashi Kajinami 2022-02-02 19:03:07 +09:00
parent 92da9357b3
commit e13544a6df
3 changed files with 32 additions and 1 deletions

View File

@ -56,6 +56,9 @@
# https://wiki.centos.org/SpecialInterestGroup/Storage/
# Optional. Defaults to False in ceph::params.
#
# [*stream*] Whether this is CentOS Stream or not. This parameter is used in CentOS only.
# Optional. Defaults to False.
#
# [*ceph_mirror*] Ceph mirror used to download packages.
# Optional. Defaults to undef.
#
@ -68,6 +71,7 @@ class ceph::repo (
$proxy_password = undef,
$enable_epel = true,
$enable_sig = $ceph::params::enable_sig,
$stream = false,
$ceph_mirror = undef,
) inherits ceph::params {
case $::osfamily {
@ -128,7 +132,11 @@ not on ${::operatingsystem}, which can lead to packaging issues.")
$ceph_mirror_real = $ceph_mirror
} else {
# NOTE(tobias-urdin): mirror.centos.org doesnt have https support
$ceph_mirror_real = "http://mirror.centos.org/centos/${::operatingsystemmajrelease}/storage/x86_64/ceph-${release}/"
if $stream {
$ceph_mirror_real = "http://mirror.centos.org/centos/${::operatingsystemmajrelease}-stream/storage/x86_64/ceph-${release}/"
} else {
$ceph_mirror_real = "http://mirror.centos.org/centos/${::operatingsystemmajrelease}/storage/x86_64/ceph-${release}/"
}
}
yumrepo { 'ceph-luminous-sig':
ensure => 'absent',

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``ceph::repo::stream`` parameter has been added. Set this parameter
to ``true`` when CentOS Stream and SIG repository are used.

View File

@ -509,6 +509,24 @@ describe 'ceph::repo' do
)}
end
context 'when using CentOS SIG repository and CentOS Stream' do
let :params do
{
:enable_sig => true,
:stream => true,
}
end
it { should_not contain_yumrepo('ext-epel-8') }
it { should_not contain_yumrepo('ext-ceph') }
it { should_not contain_yumrepo('ext-ceph-noarch') }
it { should contain_yumrepo('ceph-luminous-sig').with_ensure('absent') }
it { should contain_yumrepo('ceph-storage-sig').with(
:baseurl => 'http://mirror.centos.org/centos/8-stream/storage/x86_64/ceph-nautilus/',
)}
end
context 'when using CentOS SIG repository from a mirror' do
let :params do
{