Skip to content

Commit

Permalink
EPEL only makes sense on RH systems but not Fedora (voxpupuli#297)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jcpunk authored and sergiik committed Mar 14, 2018
1 parent c9dcfa4 commit 49679cf
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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' :
Expand Down
11 changes: 10 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
41 changes: 41 additions & 0 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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' }}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 49679cf

Please sign in to comment.