-
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install pip packages in python::install::pip
- Loading branch information
Showing
5 changed files
with
80 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# @summary Installs python pip packages | ||
class python::install::pip { | ||
include python | ||
|
||
case $python::provider { | ||
'pip': { | ||
package { 'pip': | ||
ensure => $python::pip, | ||
require => Package['python'], | ||
} | ||
} | ||
'scl': { | ||
} | ||
'rhscl': { | ||
} | ||
'anaconda': { | ||
} | ||
default: { | ||
case $facts['os']['family'] { | ||
'AIX': { | ||
unless String($python::version) =~ /^python3/ { | ||
package { 'python-pip': | ||
ensure => $python::pip, | ||
require => Package['python'], | ||
provider => 'yum', | ||
} | ||
} | ||
} | ||
default: { | ||
package { 'pip': | ||
ensure => $python::pip, | ||
require => Package['python'], | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'python::install::pip' do | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let :facts do | ||
facts | ||
end | ||
|
||
context 'with default settings' do | ||
it { is_expected.to contain_package('pip').with(ensure: 'present') } | ||
end | ||
|
||
context 'when ensuring pip is absent' do | ||
let(:pre_condition) do | ||
<<~PP | ||
class { 'python': | ||
pip => absent, | ||
} | ||
PP | ||
end | ||
|
||
it { is_expected.to contain_package('pip').with(ensure: 'absent') } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters