From 40f33b9a76b311f259ba03465559f48d010d2f97 Mon Sep 17 00:00:00 2001 From: Pat Riehecky Date: Mon, 11 Apr 2016 14:24:24 -0500 Subject: [PATCH 1/3] EPEL only makes sense on RH systems but not Fedora --- manifests/params.pp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index c19ea65a..6e34cd73 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -16,5 +16,14 @@ 'Debian' => ['3', '3.3', '2.7'], 'Suse' => [], } - $use_epel = true + + if $::osfamily == 'RedHat' { + if $::operatingsystem != 'Fedora' { + $use_epel = true + } else { + $use_epel = false + } + } else { + $use_epel = false + } } From 80b8663a4eec675c2aa647154be0f69ac2d69298 Mon Sep 17 00:00:00 2001 From: Pat Riehecky Date: Wed, 11 May 2016 15:47:28 -0500 Subject: [PATCH 2/3] Updated documentation, added test --- README.md | 2 +- spec/classes/python_spec.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f64d93a..5871dbc9 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,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/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index bcdbb003..10214e6e 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -90,6 +90,13 @@ it { is_expected.to contain_package("python-dev").with_ensure('absent') } end end + + describe "EPEL need not apply" do + context "default/empty" do + it { should_not contain_class('epel') } + end + end + end context "on a Redhat 5 OS" do @@ -112,6 +119,12 @@ # Basic python packages (from pip) it { is_expected.to contain_package("virtualenv")} + describe "EPEL may be needed" do + context "default/empty" do + it { should contain_class('epel') } + end + end + describe "with python::dev" do context "true" do let (:params) {{ :dev => 'present' }} From 30167d237eb3bb6afdc4715c5d5fb9c1b3ae9832 Mon Sep 17 00:00:00 2001 From: Pat Riehecky Date: Tue, 20 Sep 2016 15:45:39 -0500 Subject: [PATCH 3/3] updated tests: is RHEL has EPEL, is Fedora no EPEL, is RPM based but not RHEL, is Debian --- spec/classes/python_spec.rb | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index a3b718da..443a5563 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -91,7 +91,7 @@ end end - describe "EPEL need not apply" do + describe "EPEL does not exist for Debian" do context "default/empty" do it { should_not contain_class('epel') } end @@ -99,6 +99,28 @@ 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 { @@ -119,7 +141,7 @@ # Basic python packages (from pip) it { is_expected.to contain_package("virtualenv")} - describe "EPEL may be needed" do + describe "EPEL may be needed on EL" do context "default/empty" do it { should contain_class('epel') } end @@ -284,5 +306,11 @@ 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 end