From 93d6f3e327cb201585f874929b6c41718ba77620 Mon Sep 17 00:00:00 2001 From: Peter Souter Date: Mon, 19 Dec 2016 18:57:09 +0000 Subject: [PATCH] Changes RedHat repo to use the EPEL module * Yum::Install to install the RPM is a bit more flakey * EPEL module is pretty ubiquitous, not that big of a deal to add it --- .fixtures.yml | 5 ++--- manifests/plugin/cuda.pp | 4 ++-- manifests/plugin/rabbitmq.pp | 4 ++-- manifests/repo.pp | 2 +- manifests/repo/redhat.pp | 13 +------------ metadata.json | 4 ++-- spec/classes/collectd_init_spec.rb | 4 ++-- spec/spec_helper_acceptance.rb | 2 +- 8 files changed, 13 insertions(+), 25 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 8c6a87fd7..0e733f0e3 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -7,8 +7,7 @@ fixtures: concat: repo: 'git://github.com/puppetlabs/puppetlabs-concat' ref: '2.1.0' - yum: - repo: 'https://github.com/voxpupuli/puppet-yum.git' - ref: 'v0.10.0' + epel: + repo: 'https://github.com/stahnma/puppet-module-epel' symlinks: 'collectd': "#{source_dir}" diff --git a/manifests/plugin/cuda.pp b/manifests/plugin/cuda.pp index 8d6f6fe1d..314d55a26 100644 --- a/manifests/plugin/cuda.pp +++ b/manifests/plugin/cuda.pp @@ -32,9 +32,9 @@ if $::osfamily == 'RedHat' { # Epel is installed in install.pp if manage_repo is true # python-pip doesn't exist in base for RedHat. Need epel installed first - if (defined(Yum::Install['epel-release'])) { + if (defined(Class['::epel'])) { Package['python-pip'] { - require => Yum::Install['epel-release'], + require => Class['::epel'], } } } diff --git a/manifests/plugin/rabbitmq.pp b/manifests/plugin/rabbitmq.pp index 59b7086d5..dfc2368b4 100644 --- a/manifests/plugin/rabbitmq.pp +++ b/manifests/plugin/rabbitmq.pp @@ -87,9 +87,9 @@ if $::osfamily == 'RedHat' { # Epel is installed in install.pp if manage_repo is true # python-pip doesn't exist in base for RedHat. Need epel installed first - if (defined(Yum::Install['epel-release'])) { + if (defined(Class['::epel'])) { Package['python-pip'] { - require => Yum::Install['epel-release'], + require => Class['::epel'], } } } diff --git a/manifests/repo.pp b/manifests/repo.pp index cb26f07f8..a0e1a1c2b 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -10,7 +10,7 @@ $osfamily_downcase = downcase($::osfamily) if defined("::collectd::repo::${osfamily_downcase}") { - include "::collectd::repo::${osfamily_downcase}" + require "::collectd::repo::${osfamily_downcase}" } else { notify{"You have asked to manage_repo on a system that doesn't have a repo class specified: ${::osfamily}":} } diff --git a/manifests/repo/redhat.pp b/manifests/repo/redhat.pp index 0c1b564e3..3a5913158 100644 --- a/manifests/repo/redhat.pp +++ b/manifests/repo/redhat.pp @@ -10,18 +10,7 @@ } } else { - - # TODO: Replace this with EPEL module requirement in Major version bump - - if !defined(Yum::Install['epel-release']) { - yum::install { 'epel-release': - ensure => 'present', - source => "https://dl.fedoraproject.org/pub/epel/epel-release-latest-${::operatingsystemmajrelease}.noarch.rpm", - before => Package[$::collectd::package_name], - } - } - - + require ::epel } } diff --git a/metadata.json b/metadata.json index 281639ff0..cd3c50722 100644 --- a/metadata.json +++ b/metadata.json @@ -105,8 +105,8 @@ "version_requirement": ">= 1.2.5" }, { - "name": "puppet-yum", - "version_requirement": ">= 0.9.15 < 1.0.0" + "name": "stahnma-epel", + "version_requirement": ">= 1.2.2" }, { "name": "puppetlabs-apt", diff --git a/spec/classes/collectd_init_spec.rb b/spec/classes/collectd_init_spec.rb index 19608e656..186d537f9 100644 --- a/spec/classes/collectd_init_spec.rb +++ b/spec/classes/collectd_init_spec.rb @@ -29,7 +29,7 @@ ) end if facts[:osfamily] == 'RedHat' - it { is_expected.to contain_yum__install('epel-release') } + it { is_expected.to contain_class('epel') } end end @@ -191,7 +191,7 @@ context 'and ci_package_repo empty' do let(:params) { { manage_repo: true } } if facts[:osfamily] == 'RedHat' - it { is_expected.to contain_yum__install('epel-release') } + it { is_expected.to contain_class('epel') } end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index ef94b2a66..58a132474 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -17,7 +17,7 @@ on host, puppet('module', 'install', 'puppetlabs-apt'), acceptable_exit_codes: [0] on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0] on host, puppet('module', 'install', 'puppetlabs-concat'), acceptable_exit_codes: [0] - on host, puppet('module', 'install', 'puppet-yum'), acceptable_exit_codes: [0] + on host, puppet('module', 'install', 'stahnma-epel'), acceptable_exit_codes: [0] end end end