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)
 | 
					  $_repo_defaults = merge($::openstack_extras::repo::redhat::params::repo_defaults, $repo_defaults)
 | 
				
			||||||
  $_gpgkey_defaults = merge($::openstack_extras::repo::redhat::params::gpgkey_defaults, $gpgkey_defaults)
 | 
					  $_gpgkey_defaults = merge($::openstack_extras::repo::redhat::params::gpgkey_defaults, $gpgkey_defaults)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  $os_major = $::os['release']['major']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  anchor { 'openstack_extras_redhat': }
 | 
					  anchor { 'openstack_extras_redhat': }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if $manage_rdo {
 | 
					  if $manage_rdo {
 | 
				
			||||||
@@ -116,7 +118,6 @@ class openstack_extras::repo::redhat::redhat(
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if $manage_virt and ($::operatingsystem != 'Fedora') {
 | 
					  if $manage_virt and ($::operatingsystem != 'Fedora') {
 | 
				
			||||||
    $os_major = $::os['release']['major']
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if Integer.new($os_major) >= 8 {
 | 
					    if Integer.new($os_major) >= 8 {
 | 
				
			||||||
      $virt_baseurl = "${centos_mirror_url}/centos/${os_major}/virt/\$basearch/advanced-virtualization/"
 | 
					      $virt_baseurl = "${centos_mirror_url}/centos/${os_major}/virt/\$basearch/advanced-virtualization/"
 | 
				
			||||||
@@ -172,21 +173,24 @@ class openstack_extras::repo::redhat::redhat(
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if $manage_priorities and ($::operatingsystem != 'Fedora') {
 | 
					  if $manage_priorities and ($::operatingsystem != 'Fedora') {
 | 
				
			||||||
    exec { 'installing_yum-plugin-priorities':
 | 
					    if Integer.new($os_major) < 8 {
 | 
				
			||||||
      command   => '/usr/bin/yum install -y yum-plugin-priorities',
 | 
					      # yum-plugin-priorities is unavailable since RHEL/CentOS8
 | 
				
			||||||
      logoutput => 'on_failure',
 | 
					      exec { 'installing_yum-plugin-priorities':
 | 
				
			||||||
      tries     => 3,
 | 
					        command   => '/usr/bin/yum install -y yum-plugin-priorities',
 | 
				
			||||||
      try_sleep => 1,
 | 
					        logoutput => 'on_failure',
 | 
				
			||||||
      unless    => '/usr/bin/rpm -qa | /usr/bin/grep -q yum-plugin-priorities',
 | 
					        tries     => 3,
 | 
				
			||||||
 | 
					        try_sleep => 1,
 | 
				
			||||||
 | 
					        unless    => '/usr/bin/rpm -qa | /usr/bin/grep -q yum-plugin-priorities',
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      Exec['installing_yum-plugin-priorities'] -> Yumrepo<||>
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    Exec['installing_yum-plugin-priorities'] -> Yumrepo<||>
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if $package_require {
 | 
					  if $package_require {
 | 
				
			||||||
      Yumrepo<||> -> Package<||>
 | 
					      Yumrepo<||> -> Package<||>
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ($::operatingsystem == 'Fedora') {
 | 
					  if ($::operatingsystem == 'Fedora') or (Integer.new($os_major) >= 8) {
 | 
				
			||||||
    exec { 'yum_refresh':
 | 
					    exec { 'yum_refresh':
 | 
				
			||||||
      command     => '/usr/bin/dnf clean all',
 | 
					      command     => '/usr/bin/dnf clean all',
 | 
				
			||||||
      refreshonly => true,
 | 
					      refreshonly => true,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -109,6 +109,14 @@ describe 'openstack_extras::repo::redhat::redhat' do
 | 
				
			|||||||
      )}
 | 
					      )}
 | 
				
			||||||
    end
 | 
					    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
 | 
					    context 'with overridden release' do
 | 
				
			||||||
      let :params do
 | 
					      let :params do
 | 
				
			||||||
        default_params.merge!({ :release => 'juno' })
 | 
					        default_params.merge!({ :release => 'juno' })
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user