Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow pip to work in AIX systems #461

Merged
merged 10 commits into from
Jan 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
48 changes: 37 additions & 11 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
default => "${python::version}", # lint:ignore:only_variable_string
}

$pythondev = $::osfamily ? {
$pythondev = $facts['os']['family'] ? {
'AIX' => "${python}-devel",
feltra marked this conversation as resolved.
Show resolved Hide resolved
'RedHat' => "${python}-devel",
'Debian' => "${python}-dev",
'Suse' => "${python}-devel",
Expand Down Expand Up @@ -83,7 +84,7 @@
Package <| title == 'virtualenv' |> {
name => 'virtualenv',
provider => 'pip',
require => Package[$pythondev],
require => Package['python-dev'],
}
}
'scl': {
Expand Down Expand Up @@ -177,17 +178,42 @@
}
}
default: {
case $facts['os']['family'] {
'AIX': {
if "${::python::version}" =~ /^python3/ { #lint:ignore:only_variable_string
feltra marked this conversation as resolved.
Show resolved Hide resolved
class { 'python::pip::bootstap':
version => 'pip3',
}
} else {
package { 'python-pip':
ensure => $pip_ensure,
require => Package['python'],
provider => 'yum',
}
}
if $pythondev {
package { 'python-dev':
ensure => $dev_ensure,
name => $pythondev,
alias => $pythondev,
provider => 'yum',
}
}

package { 'pip':
ensure => $pip_ensure,
require => Package['python'],
}
}
default: {
package { 'pip':
ensure => $pip_ensure,
require => Package['python'],
}
if $pythondev {
package { 'python-dev':
ensure => $dev_ensure,
name => $pythondev,
alias => $pythondev,
}
}

if $pythondev {
package { 'python-dev':
ensure => $dev_ensure,
name => $pythondev,
alias => $pythondev,
}
}

Expand Down
13 changes: 10 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# @api private
# @summary The python Module default configuration settings.
# == Class: python::params
feltra marked this conversation as resolved.
Show resolved Hide resolved
#
# The python Module default configuration settings.
#
class python::params {
$ensure = 'present'
Expand All @@ -14,6 +15,7 @@
'RedHat' => ['3','27','33'],
'Debian' => ['3', '3.3', '2.7'],
'Suse' => [],
'AIX' => ['python3'],
'Gentoo' => ['2.7', '3.3', '3.4', '3.5']
}

Expand All @@ -27,12 +29,17 @@
$use_epel = false
}

$group = $facts['os']['family'] ? {
'AIX' => 'system',
default => 'root'
}

$pip_lookup_path = $facts['os']['family'] ? {
'AIX' => [ '/bin', '/usr/bin', '/usr/local/bin', '/opt/freeware/bin/' ],
default => [ '/bin', '/usr/bin', '/usr/local/bin' ]
}

$gunicorn_package_name = $::osfamily ? {
$gunicorn_package_name = $facts['os']['family'] ? {
feltra marked this conversation as resolved.
Show resolved Hide resolved
'RedHat' => 'python-gunicorn',
default => 'gunicorn',
}
Expand Down
24 changes: 14 additions & 10 deletions manifests/pip.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

#
# @summary Installs and manages packages from pip.
#
# @param name must be unique
Expand Down Expand Up @@ -56,7 +55,7 @@
Enum['pip', 'pip3'] $pip_provider = 'pip',
Variant[Boolean, String] $url = false,
String[1] $owner = 'root',
String[1] $group = 'root',
$group = undef,
$umask = undef,
$index = false,
Variant[Boolean, String] $proxy = false,
Expand All @@ -69,10 +68,15 @@
Numeric $timeout = 1800,
String[1] $log_dir = '/tmp',
Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'],
) {
){
$python_provider = getparam(Class['python'], 'provider')
$python_version = getparam(Class['python'], 'version')

if $group {
$_group = $group
} else {
include ::python::params
feltra marked this conversation as resolved.
Show resolved Hide resolved
$_group = $python::params::group
}
# Get SCL exec prefix
# NB: this will not work if you are running puppet from scl enabled shell
$exec_prefix = $python_provider ? {
Expand Down Expand Up @@ -184,7 +188,7 @@
command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}@${ensure}#egg=${egg_name} || ${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name} ;}",
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}",
user => $owner,
group => $group,
group => $_group,
umask => $umask,
cwd => $cwd,
environment => $environment,
Expand All @@ -196,7 +200,7 @@
command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${install_args} ${pip_common_args} ;}",
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}",
user => $owner,
group => $group,
group => $_group,
umask => $umask,
cwd => $cwd,
environment => $environment,
Expand All @@ -213,7 +217,7 @@
command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}==${ensure} || ${pip_install} ${install_args} ${pip_common_args}==${ensure} ;}",
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}",
user => $owner,
group => $group,
group => $_group,
umask => $umask,
cwd => $cwd,
environment => $environment,
Expand All @@ -228,7 +232,7 @@
command => "${wheel_check} ; { ${pip_install} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${pip_common_args} ;}",
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}",
user => $owner,
group => $group,
group => $_group,
umask => $umask,
cwd => $cwd,
environment => $environment,
Expand Down Expand Up @@ -259,7 +263,7 @@
command => "${wheel_check} ; { ${pip_install} --upgrade \$wheel_support_flag ${pip_common_args} || ${pip_install} --upgrade ${pip_common_args} ;}",
unless => $unless_command,
user => $owner,
group => $group,
group => $_group,
umask => $umask,
cwd => $cwd,
environment => $environment,
Expand All @@ -274,7 +278,7 @@
command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}",
onlyif => "${pip_env} freeze --all | grep -i -e ${grep_regex}",
user => $owner,
group => $group,
group => $_group,
umask => $umask,
cwd => $cwd,
environment => $environment,
Expand Down