Browse Source

Add stream parameter to openstack_extras::repo::redhat::redhat

Change-Id: I66bbc9c84a309da451748734f23f43d4f4277cc1
(cherry picked from commit 3ecddc5926)
(cherry picked from commit 248294304a)
changes/28/788928/1
Tobias Urdin 8 months ago
parent
commit
e44d8698db
  1. 21
      manifests/repo/redhat/redhat.pp
  2. 5
      releasenotes/notes/add-redhat-repo-stream-param-e07601e273aad56c.yaml
  3. 18
      spec/classes/openstack_extras_repo_redhat_redhat_spec.rb

21
manifests/repo/redhat/redhat.pp

@ -78,6 +78,10 @@
# configured.
# Defaults to false
#
# [*stream*]
# (optional) Is this CentOS Stream and we should adjust mirrors thereafter.
# Defaults to false
#
class openstack_extras::repo::redhat::redhat(
$release = $::openstack_extras::repo::redhat::params::release,
$manage_rdo = true,
@ -94,6 +98,7 @@ class openstack_extras::repo::redhat::redhat(
$manage_priorities = true,
$centos_mirror_url = 'http://mirror.centos.org',
$update_packages = false,
$stream = false,
) inherits openstack_extras::repo::redhat::params {
validate_legacy(String, 'validate_string', $release)
@ -111,6 +116,10 @@ class openstack_extras::repo::redhat::redhat(
$_gpgkey_defaults = merge($::openstack_extras::repo::redhat::params::gpgkey_defaults, $gpgkey_defaults)
$os_major = $::os['release']['major']
$centos_major = $stream ? {
true => "${os_major}-stream",
default => $os_major
}
anchor { 'openstack_extras_redhat': }
@ -119,7 +128,7 @@ class openstack_extras::repo::redhat::redhat(
$rdo_hash = {
'rdo-release' => {
'baseurl' => "${centos_mirror_url}/centos/${::os['release']['major']}/cloud/\$basearch/openstack-${release}/",
'baseurl' => "${centos_mirror_url}/centos/${centos_major}/cloud/\$basearch/openstack-${release}/",
'descr' => "OpenStack ${release_cap} Repository",
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud',
}
@ -137,15 +146,19 @@ class openstack_extras::repo::redhat::redhat(
if $manage_virt and ($::operatingsystem != 'Fedora') {
if Integer.new($os_major) >= 8 {
$virt_baseurl = "${centos_mirror_url}/centos/${os_major}/virt/\$basearch/advanced-virtualization/"
if $stream {
$virt_baseurl = "${centos_mirror_url}/centos/${centos_major}/virt/\$basearch/advancedvirt-common/"
} else {
$virt_baseurl = "${centos_mirror_url}/centos/${centos_major}/virt/\$basearch/advanced-virtualization/"
}
} else {
$virt_baseurl = "${centos_mirror_url}/centos/${os_major}/virt/\$basearch/kvm-common/"
$virt_baseurl = "${centos_mirror_url}/centos/${centos_major}/virt/\$basearch/kvm-common/"
}
$virt_hash = {
'rdo-qemu-ev' => {
'baseurl' => $virt_baseurl,
'descr' => "RDO CentOS-${$os_major} - QEMU EV",
'descr' => "RDO CentOS-${$centos_major} - QEMU EV",
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization',
}
}

5
releasenotes/notes/add-redhat-repo-stream-param-e07601e273aad56c.yaml

@ -0,0 +1,5 @@
---
features:
- |
Added ``stream`` parameter (defaulting to false) to the openstack_extras::repo::redhat::redhat
class that if set to true instructs Puppet to create repositories for CentOS Stream.

18
spec/classes/openstack_extras_repo_redhat_redhat_spec.rb

@ -117,6 +117,24 @@ describe 'openstack_extras::repo::redhat::redhat' do
it { should_not contain_exec('installing_yum-plugin-priorities') }
end
context 'with major release 8 and stream set to true' do
let :params do
default_params.merge!( :stream => true )
end
before do
facts.merge!( :os => {'release' => {'major' => 8}} )
end
it { should contain_yumrepo('rdo-release').with(
:baseurl => "http://mirror.centos.org/centos/8-stream/cloud/$basearch/openstack-victoria/",
)}
it { should contain_yumrepo('rdo-qemu-ev').with(
:baseurl => "http://mirror.centos.org/centos/8-stream/virt/$basearch/advancedvirt-common/",
)}
end
context 'with overridden release' do
let :params do
default_params.merge!({ :release => 'juno' })

Loading…
Cancel
Save