Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome work, thank you!

Would you mind adding a case for RedHat 6, that shows the same thing as this, but with the correct pip package name and update the existing RedHat 5 part with the name attribute. That would give us much better testing for all use cases with EL.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a change that adds tests for 6 and tests the name on 5 too.

I would suggest rewriting the spec tests at some point so there isn't that much divergence between the different operating systems. E.g.

require 'spec_helper'
describe 'python', :type => :class do
  context 'supported operating systems' do
    on_supported_os.each do |os, facts|
      context "on #{os}" do

Something for the future.

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