Set module_hotfixes=true for yumrepo if Puppet >= 6.15.0

The RDO and CentOS Advanced Virt repositories contains
packages that should be considered hotfixes to version
found in Base repo and similar and should have priority
over them.

The yumrepo_core [1] change that was released in 1.0.7
adds the module_hotfixes parameter to yumrepo and it's
included in Puppet >= 6.15.0 which we should set to true
to make sure packages in RDO and CentOS Advanced Virt
repos is considered hotfixes upon base packages.

When we only support Puppet 7 and forward we should set
this by default for the yumrepo resources.

[1] a14c059b7d

Depends-On: https://review.opendev.org/c/792966
Change-Id: Ie747273e2ce23fadba0f3946e227ee143c1632db
This commit is contained in:
Tobias Urdin 2021-05-25 13:31:54 +02:00
parent bf93facef3
commit ad70eae45b
3 changed files with 57 additions and 16 deletions

View File

@ -147,6 +147,15 @@ class openstack_extras::repo::redhat::redhat (
create_resources('file', $rdokey_hash, $_gpgkey_defaults)
create_resources('yumrepo', $rdo_hash, $_repo_defaults)
# NOTE(tobias-urdin): This was introduced in yumrepo_core 1.0.7 which is
# included from 6.15.0 and forward (also since 7.0.0).
# TODO(tobias-urdin): Should set this by default when we only support Puppet 7.
if versioncmp($::puppetversion, '6.15.0') >= 0 {
Yumrepo<| title == 'rdo-release' |> {
module_hotfixes => true,
}
}
}
if $manage_virt and ($facts['os']['name'] != 'Fedora') {
@ -177,6 +186,15 @@ class openstack_extras::repo::redhat::redhat (
create_resources('file', $virtkey_hash, $_gpgkey_defaults)
create_resources('yumrepo', $virt_hash, $_repo_defaults)
# NOTE(tobias-urdin): This was introduced in yumrepo_core 1.0.7 which is
# included from 6.15.0 and forward (also since 7.0.0).
# TODO(tobias-urdin): Should set this by default when we only support Puppet 7.
if versioncmp($::puppetversion, '6.15.0') >= 0 {
Yumrepo<| title == 'centos-advanced-virt' |> {
module_hotfixes => true,
}
}
}
if ($manage_epel and $facts['os']['name'] != 'Fedora') {

View File

@ -0,0 +1,10 @@
---
features:
- |
The yumrepo resources for RDO and CentOS Advanced Virt in the
openstack_extras::repo::redhat::redhat class now sets the new
parameter module_hotfixes included since 6.15.0 if the Puppet
version is supporting that. If you for some reason is using
standalone Puppet that does not include vendored modules (i.e
you are not using Puppet packages) you will need to make sure
that yumrepo_core >= 1.0.7 is used.

View File

@ -20,6 +20,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
:enabled => '1',
:gpgcheck => '1',
:mirrorlist => 'absent',
:module_hotfixes => true,
:notify => 'Exec[yum_refresh]',
:require => 'Anchor[openstack_extras_redhat]',
)}
@ -41,6 +42,7 @@ describe 'openstack_extras::repo::redhat::redhat' do
:enabled => '1',
:gpgcheck => '1',
:mirrorlist => 'absent',
:module_hotfixes => true,
:notify => 'Exec[yum_refresh]',
:require => 'Anchor[openstack_extras_redhat]',
)}
@ -58,6 +60,17 @@ describe 'openstack_extras::repo::redhat::redhat' do
it { should_not contain_exec('yum_update') }
end
context 'with default parameters but puppetversion < 6.15.0' do
before do
facts.merge!( :puppetversion => '6.14.0' )
end
it {
should contain_yumrepo('rdo-release').without_module_hotfixes
should contain_yumrepo('centos-advanced-virt').without_module_hotfixes
}
end
context 'with parameters' do
let :params do
{