From 49679cf0aebf3e22d5739ecf69c779eb47eae274 Mon Sep 17 00:00:00 2001 From: Pat Riehecky Date: Thu, 8 Dec 2016 14:33:17 -0600 Subject: [PATCH] EPEL only makes sense on RH systems but not Fedora (#297) * EPEL only makes sense on RH systems but not Fedora * Updated documentation, added test * updated tests: is RHEL has EPEL, is Fedora no EPEL, is RPM based but not RHEL, is Debian --- README.md | 2 +- manifests/params.pp | 11 +++++++++- spec/classes/python_spec.rb | 41 +++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba3d924a..36ecec4e 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Installs and manages python, python-pip, python-dev, python-virtualenv and Gunic **manage_gunicorn** - Allow Installation / Removal of Gunicorn. Default: true -**use_epel** - Boolean to determine if the epel class is used. Default: true +**use_epel** - Boolean to determine if the epel class is used. Default: true on RHEL like systems, false otherwise ```puppet class { 'python' : diff --git a/manifests/params.pp b/manifests/params.pp index a64d0a38..bec6815c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -17,7 +17,16 @@ 'Suse' => [], 'Gentoo' => ['2.7', '3.3', '3.4', '3.5'] } - $use_epel = true + + if $::osfamily == 'RedHat' { + if $::operatingsystem != 'Fedora' { + $use_epel = true + } else { + $use_epel = false + } + } else { + $use_epel = false + } $gunicorn_package_name = $::osfamily ? { 'RedHat' => 'python-gunicorn', diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 64ee412a..9448fa6c 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -90,8 +90,37 @@ it { is_expected.to contain_package("python-dev").with_ensure('absent') } end end + + describe "EPEL does not exist for Debian" do + context "default/empty" do + it { should_not contain_class('epel') } + end + end + + end + + context "on a Fedora 22 OS" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :osfamily => 'RedHat', + :operatingsystem => 'Fedora', + :operatingsystemrelease => '22', + :concat_basedir => '/dne', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + } + end + + describe "EPEL does not exist for Fedora" do + context "default/empty" do + it { should_not contain_class('epel') } + end + end + end + context "on a Redhat 5 OS" do let :facts do { @@ -112,6 +141,12 @@ # Basic python packages (from pip) it { is_expected.to contain_package("virtualenv")} + describe "EPEL may be needed on EL" do + context "default/empty" do + it { should contain_class('epel') } + end + end + describe "with python::dev" do context "true" do let (:params) {{ :dev => 'present' }} @@ -271,6 +306,12 @@ it { is_expected.to contain_package("python-dev").with_ensure('absent') } end end + + describe "EPEL does not exist on Suse" do + context "default/empty" do + it { should_not contain_class('epel') } + end + end end context "on a Gentoo OS" do