diff --git a/manifests/repo/redhat/redhat.pp b/manifests/repo/redhat/redhat.pp index 7599fb2..12567cf 100644 --- a/manifests/repo/redhat/redhat.pp +++ b/manifests/repo/redhat/redhat.pp @@ -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') { diff --git a/releasenotes/notes/set-module-hotfixes-redhat-repo-e03358eb341bf820.yaml b/releasenotes/notes/set-module-hotfixes-redhat-repo-e03358eb341bf820.yaml new file mode 100644 index 0000000..57fa50d --- /dev/null +++ b/releasenotes/notes/set-module-hotfixes-redhat-repo-e03358eb341bf820.yaml @@ -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. \ No newline at end of file diff --git a/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb b/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb index 02d892d..eae6147 100644 --- a/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb +++ b/spec/classes/openstack_extras_repo_redhat_redhat_spec.rb @@ -14,14 +14,15 @@ describe 'openstack_extras::repo::redhat::redhat' do )} it { should contain_yumrepo('rdo-release').with( - :baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}-stream/cloud/$basearch/openstack-victoria/", - :descr => "OpenStack Victoria Repository", - :gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud', - :enabled => '1', - :gpgcheck => '1', - :mirrorlist => 'absent', - :notify => 'Exec[yum_refresh]', - :require => 'Anchor[openstack_extras_redhat]', + :baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}-stream/cloud/$basearch/openstack-victoria/", + :descr => "OpenStack Victoria 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_yumrepo('rdo-qemu-ev').with_ensure('absent') } @@ -35,14 +36,15 @@ describe 'openstack_extras::repo::redhat::redhat' do )} it { should contain_yumrepo('centos-advanced-virt').with( - :baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}-stream/virt/$basearch/advancedvirt-common/", - :descr => "CentOS-#{facts[:operatingsystemmajrelease]}-stream - Advanced Virt", - :gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization', - :enabled => '1', - :gpgcheck => '1', - :mirrorlist => 'absent', - :notify => 'Exec[yum_refresh]', - :require => 'Anchor[openstack_extras_redhat]', + :baseurl => "http://mirror.centos.org/centos/#{facts[:operatingsystemmajrelease]}-stream/virt/$basearch/advancedvirt-common/", + :descr => "CentOS-#{facts[:operatingsystemmajrelease]}-stream - Advanced Virt", + :gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Virtualization', + :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]}") } @@ -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 {