Require yum-plugin-priorities only in CentOS/RHEL<8
... because it was merged into dnf package since CentOS/RHEL8. Change-Id: I468935b91c5dd2e06cffab26c78eff1843c207cd
This commit is contained in:
		@@ -93,6 +93,8 @@ class openstack_extras::repo::redhat::redhat(
 | 
			
		||||
  $_repo_defaults = merge($::openstack_extras::repo::redhat::params::repo_defaults, $repo_defaults)
 | 
			
		||||
  $_gpgkey_defaults = merge($::openstack_extras::repo::redhat::params::gpgkey_defaults, $gpgkey_defaults)
 | 
			
		||||
 | 
			
		||||
  $os_major = $::os['release']['major']
 | 
			
		||||
 | 
			
		||||
  anchor { 'openstack_extras_redhat': }
 | 
			
		||||
 | 
			
		||||
  if $manage_rdo {
 | 
			
		||||
@@ -116,7 +118,6 @@ 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/"
 | 
			
		||||
@@ -172,6 +173,8 @@ class openstack_extras::repo::redhat::redhat(
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if $manage_priorities and ($::operatingsystem != 'Fedora') {
 | 
			
		||||
    if Integer.new($os_major) < 8 {
 | 
			
		||||
      # yum-plugin-priorities is unavailable since RHEL/CentOS8
 | 
			
		||||
      exec { 'installing_yum-plugin-priorities':
 | 
			
		||||
        command   => '/usr/bin/yum install -y yum-plugin-priorities',
 | 
			
		||||
        logoutput => 'on_failure',
 | 
			
		||||
@@ -181,12 +184,13 @@ class openstack_extras::repo::redhat::redhat(
 | 
			
		||||
      }
 | 
			
		||||
      Exec['installing_yum-plugin-priorities'] -> Yumrepo<||>
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if $package_require {
 | 
			
		||||
      Yumrepo<||> -> Package<||>
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if ($::operatingsystem == 'Fedora') {
 | 
			
		||||
  if ($::operatingsystem == 'Fedora') or (Integer.new($os_major) >= 8) {
 | 
			
		||||
    exec { 'yum_refresh':
 | 
			
		||||
      command     => '/usr/bin/dnf clean all',
 | 
			
		||||
      refreshonly => true,
 | 
			
		||||
 
 | 
			
		||||
@@ -109,6 +109,14 @@ describe 'openstack_extras::repo::redhat::redhat' do
 | 
			
		||||
      )}
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with major release 8' do
 | 
			
		||||
      before do
 | 
			
		||||
        facts.merge!( :os => {'release' => {'major' => 8}} )
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it { should_not contain_exec('installing_yum-plugin-priorities') }
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with overridden release' do
 | 
			
		||||
      let :params do
 | 
			
		||||
        default_params.merge!({ :release => 'juno' })
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user