From 5dd932a8fd3e934712b2501e558a98c7639e5bc4 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Thu, 24 Mar 2016 18:30:43 -0400 Subject: [PATCH] repo: allow to disable EPEL repository Allow to disable EPEL repository, but keep it enabled by default for backward compatibility. Change-Id: I9cbf1a4e84d51ffd05b30ac7505cb76b5b352694 --- manifests/repo.pp | 31 +++++++++++++++++++------------ spec/classes/ceph_repo_spec.rb | 10 ++++++++++ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/manifests/repo.pp b/manifests/repo.pp index 4cc3c28c..b238947b 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -48,6 +48,9 @@ # [*proxy_password*] The password to be used for the proxy if one should be required # Optional. Defaults to 'undef' # +# [*enable_epel*] Whether or not enable EPEL repository. +# Optional. Defaults to True +# class ceph::repo ( $ensure = present, $release = 'hammer', @@ -55,6 +58,7 @@ class ceph::repo ( $proxy = undef, $proxy_username = undef, $proxy_password = undef, + $enable_epel = true, ) { case $::osfamily { 'Debian': { @@ -122,18 +126,21 @@ class ceph::repo ( proxy_username => $proxy_username, proxy_password => $proxy_password, } - yumrepo { "ext-epel-${el}": - # puppet versions prior to 3.5 do not support ensure, use enabled instead - enabled => $enabled, - descr => "External EPEL ${el}", - name => "ext-epel-${el}", - baseurl => absent, - gpgcheck => '1', - gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${el}", - mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-${el}&arch=\$basearch", - priority => '20', # prefer ceph repos over EPEL - tag => 'ceph', - exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', + + if $enable_epel { + yumrepo { "ext-epel-${el}": + # puppet versions prior to 3.5 do not support ensure, use enabled instead + enabled => $enabled, + descr => "External EPEL ${el}", + name => "ext-epel-${el}", + baseurl => absent, + gpgcheck => '1', + gpgkey => "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${el}", + mirrorlist => "http://mirrors.fedoraproject.org/metalink?repo=epel-${el}&arch=\$basearch", + priority => '20', # prefer ceph repos over EPEL + tag => 'ceph', + exclude => 'python-ceph-compat python-rbd python-rados python-cephfs', + } } yumrepo { 'ext-ceph': diff --git a/spec/classes/ceph_repo_spec.rb b/spec/classes/ceph_repo_spec.rb index be68b8b0..337a7f8e 100644 --- a/spec/classes/ceph_repo_spec.rb +++ b/spec/classes/ceph_repo_spec.rb @@ -248,6 +248,16 @@ describe 'ceph::repo' do ) } end + describe "when disabling EPEL" do + let :params do + { + :enable_epel => false, + } + end + + it { is_expected.to_not contain_yumrepo('ext-epel-7') } + end + describe "when using a proxy for yum repositories" do let :params do {