Browse Source

Merge "Replace hardcoded CentOS version with fact"

tags/16.2.0
Zuul 3 months ago
committed by Gerrit Code Review
parent
commit
c29824fc07
2 changed files with 33 additions and 3 deletions
  1. +11
    -3
      manifests/repo/redhat/redhat.pp
  2. +22
    -0
      spec/classes/openstack_extras_repo_redhat_redhat_spec.rb

+ 11
- 3
manifests/repo/redhat/redhat.pp View File

@@ -100,7 +100,7 @@ class openstack_extras::repo::redhat::redhat(

$rdo_hash = {
'rdo-release' => {
'baseurl' => "${centos_mirror_url}/centos/7/cloud/\$basearch/openstack-${release}/",
'baseurl' => "${centos_mirror_url}/centos/${::os['release']['major']}/cloud/\$basearch/openstack-${release}/",
'descr' => "OpenStack ${release_cap} Repository",
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud',
}
@@ -116,10 +116,18 @@ class openstack_extras::repo::redhat::redhat(
}

if $manage_virt and ($::operatingsystem != 'Fedora') {
$os_major = $::os['release']['major']

if Integer.new($os_major) >= 8 {
$virt_baseurl = "${centos_mirror_url}/centos/${os_major}/virt/\$basearch/advanced-virtualization/"
} else {
$virt_baseurl = "${centos_mirror_url}/centos/${os_major}/virt/\$basearch/kvm-common/"
}

$virt_hash = {
'rdo-qemu-ev' => {
'baseurl' => "${centos_mirror_url}/centos/7/virt/\$basearch/kvm-common/",
'descr' => 'RDO CentOS-7 - QEMU EV',
'baseurl' => $virt_baseurl,
'descr' => "RDO CentOS-${$os_major} - QEMU EV",
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization',
}
}


+ 22
- 0
spec/classes/openstack_extras_repo_redhat_redhat_spec.rb View File

@@ -88,6 +88,27 @@ describe 'openstack_extras::repo::redhat::redhat' do
it { should_not contain_yumrepo('epel') }
end

context 'with major release 8 or later and virt repo enabled' do
let :params do
default_params.merge!( :manage_virt => true )
end

before do
facts.merge!( :os => {'release' => {'major' => 8}} )
end

it { should contain_yumrepo('rdo-qemu-ev').with(
:baseurl => "http://mirror.centos.org/centos/8/virt/$basearch/advanced-virtualization/",
:descr => 'RDO CentOS-8 - QEMU EV',
:gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization',
:enabled => '1',
:gpgcheck => '1',
:mirrorlist => 'absent',
:require => 'Anchor[openstack_extras_redhat]',
:notify => 'Exec[yum_refresh]'
)}
end

context 'with overridden release' do
let :params do
default_params.merge!({ :release => 'juno' })
@@ -248,6 +269,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
facts.merge!(OSDefaults.get_facts({ :operatingsystem => 'RedHat',
:operatingsystemrelease => '7.1',
:operatingsystemmajrelease => '7',
:os => {'release' => {'major' => '7'}},
:puppetversion => Puppet.version }))
end



Loading…
Cancel
Save