Skip to content

Commit 29aa2f3

Browse files
ju5tghoneycutt
authored andcommitted
Fix pip package name on EL7 (voxpupuli#347)
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
1 parent 15d1666 commit 29aa2f3

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

Diff for: manifests/install.pp

+3
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@
213213
if $::python::version =~ /^3/ {
214214
$pip_category = undef
215215
$pip_package = 'python3-pip'
216+
} elsif ($::osfamily == 'RedHat') and (versioncmp($::operatingsystemmajrelease, '7') >= 0) {
217+
$pip_category = undef
218+
$pip_package = 'python2-pip'
216219
} elsif $::osfamily == 'Gentoo' {
217220
$pip_category = 'dev-python'
218221
$pip_package = 'pip'

Diff for: spec/classes/python_spec.rb

+33
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
it { is_expected.to contain_package("python") }
139139
it { is_expected.to contain_package("python-dev").with_name("python-devel") }
140140
it { is_expected.to contain_package("pip") }
141+
it { is_expected.to contain_package("pip").with_name('python-pip') }
141142
# Basic python packages (from pip)
142143
it { is_expected.to contain_package("virtualenv")}
143144

@@ -217,6 +218,38 @@
217218
end
218219
end
219220

221+
context "on a Redhat 6 OS" do
222+
let :facts do
223+
{
224+
:id => 'root',
225+
:kernel => 'Linux',
226+
:osfamily => 'RedHat',
227+
:operatingsystem => 'RedHat',
228+
:operatingsystemmajrelease => '6',
229+
:concat_basedir => '/dne',
230+
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
231+
}
232+
end
233+
it { is_expected.to contain_class("python::install") }
234+
it { is_expected.to contain_package("pip").with_name('python-pip') }
235+
end
236+
237+
context "on a Redhat 7 OS" do
238+
let :facts do
239+
{
240+
:id => 'root',
241+
:kernel => 'Linux',
242+
:osfamily => 'RedHat',
243+
:operatingsystem => 'RedHat',
244+
:operatingsystemmajrelease => '7',
245+
:concat_basedir => '/dne',
246+
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
247+
}
248+
end
249+
it { is_expected.to contain_class("python::install") }
250+
it { is_expected.to contain_package("pip").with_name('python2-pip') }
251+
end
252+
220253
context "on a SLES 11 SP3" do
221254
let :facts do
222255
{

0 commit comments

Comments
 (0)