diff --git a/manifests/repo/redhat/params.pp b/manifests/repo/redhat/params.pp index a29bf91..28962e4 100644 --- a/manifests/repo/redhat/params.pp +++ b/manifests/repo/redhat/params.pp @@ -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 = { diff --git a/manifests/repo/redhat/redhat.pp b/manifests/repo/redhat/redhat.pp index c511830..fd1b864 100644 --- a/manifests/repo/redhat/redhat.pp +++ b/manifests/repo/redhat/redhat.pp @@ -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', } diff --git a/releasenotes/notes/bug-1978332-8b223e30a7f30165.yaml b/releasenotes/notes/bug-1978332-8b223e30a7f30165.yaml new file mode 100644 index 0000000..25053ff --- /dev/null +++ b/releasenotes/notes/bug-1978332-8b223e30a7f30165.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + The ``openstack_extras::repos::redhat::redhat`` class now configures RDO + repository properly in CentOS Stream 9. diff --git a/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb b/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb index 6d5e53b..ea678ee 100644 --- a/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb +++ b/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb @@ -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