Skip to content

Commit

Permalink
Fix pip package name on EL7 (voxpupuli#347)
Browse files Browse the repository at this point in the history
Now uses the correct package name 'python2-pip'.

Due to a recent change in EPEL the python-pip package was renamed
to python2-pip. This currently breaks this module on CentOS 7. This
commit makes sure that it defaults to python2-pip if the system is
running Python 2 on CentOS 7 when using EPEL.

* Remove the unneeded dependency on EPEL

* Added pip package tests on RHEL 5 and 6
  • Loading branch information
ju5t authored and sergiik committed Mar 14, 2018
1 parent b75a311 commit 56661bc
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@
if $::python::version =~ /^3/ {
$pip_category = undef
$pip_package = 'python3-pip'
} elsif ($::osfamily == 'RedHat') and (versioncmp($::operatingsystemmajrelease, '7') >= 0) {
$pip_category = undef
$pip_package = 'python2-pip'
} elsif $::osfamily == 'Gentoo' {
$pip_category = 'dev-python'
$pip_package = 'pip'
Expand Down
33 changes: 33 additions & 0 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
it { is_expected.to contain_package("python") }
it { is_expected.to contain_package("python-dev").with_name("python-devel") }
it { is_expected.to contain_package("pip") }
it { is_expected.to contain_package("pip").with_name('python-pip') }
# Basic python packages (from pip)
it { is_expected.to contain_package("virtualenv")}

Expand Down Expand Up @@ -217,6 +218,38 @@
end
end

context "on a Redhat 6 OS" do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemmajrelease => '6',
:concat_basedir => '/dne',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
it { is_expected.to contain_class("python::install") }
it { is_expected.to contain_package("pip").with_name('python-pip') }
end

context "on a Redhat 7 OS" do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemmajrelease => '7',
:concat_basedir => '/dne',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end
it { is_expected.to contain_class("python::install") }
it { is_expected.to contain_package("pip").with_name('python2-pip') }
end

context "on a SLES 11 SP3" do
let :facts do
{
Expand Down

0 comments on commit 56661bc

Please sign in to comment.