Skip to content

Commit f301750

Browse files
committed
Allow pip to work in AIX systems
1 parent c7ab354 commit f301750

3 files changed

Lines changed: 61 additions & 24 deletions

File tree

manifests/install.pp

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
default => "${python::version}", # lint:ignore:only_variable_string
1313
}
1414

15-
$pythondev = $::osfamily ? {
15+
$pythondev = $facts['os']['family'] ? {
16+
'AIX' => "${python}-devel",
1617
'RedHat' => "${python}-devel",
1718
'Debian' => "${python}-dev",
1819
'Suse' => "${python}-devel",
@@ -83,7 +84,7 @@
8384
Package <| title == 'virtualenv' |> {
8485
name => 'virtualenv',
8586
provider => 'pip',
86-
require => Package[$pythondev],
87+
require => Package['python-dev'],
8788
}
8889
}
8990
'scl': {
@@ -177,17 +178,42 @@
177178
}
178179
}
179180
default: {
181+
case $facts['os']['family'] {
182+
'AIX': {
183+
if "${::python::version}" =~ /^python3/ { #lint:ignore:only_variable_string
184+
class { 'python::pip::bootstap':
185+
version => 'pip3',
186+
}
187+
} else {
188+
package { 'python-pip':
189+
ensure => $pip_ensure,
190+
require => Package['python'],
191+
provider => 'yum',
192+
}
193+
}
194+
if $pythondev {
195+
package { 'python-dev':
196+
ensure => $dev_ensure,
197+
name => $pythondev,
198+
alias => $pythondev,
199+
provider => 'yum',
200+
}
201+
}
180202

181-
package { 'pip':
182-
ensure => $pip_ensure,
183-
require => Package['python'],
184-
}
203+
}
204+
default: {
205+
package { 'pip':
206+
ensure => $pip_ensure,
207+
require => Package['python'],
208+
}
209+
if $pythondev {
210+
package { 'python-dev':
211+
ensure => $dev_ensure,
212+
name => $pythondev,
213+
alias => $pythondev,
214+
}
215+
}
185216

186-
if $pythondev {
187-
package { 'python-dev':
188-
ensure => $dev_ensure,
189-
name => $pythondev,
190-
alias => $pythondev,
191217
}
192218
}
193219

manifests/params.pp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# @api private
2-
# @summary The python Module default configuration settings.
1+
# == Class: python::params
2+
#
3+
# The python Module default configuration settings.
34
#
45
class python::params {
56
$ensure = 'present'
@@ -14,6 +15,7 @@
1415
'RedHat' => ['3','27','33'],
1516
'Debian' => ['3', '3.3', '2.7'],
1617
'Suse' => [],
18+
'AIX' => ['python3'],
1719
'Gentoo' => ['2.7', '3.3', '3.4', '3.5']
1820
}
1921

@@ -27,12 +29,17 @@
2729
$use_epel = false
2830
}
2931

32+
$group = $facts['os']['family'] ? {
33+
'AIX' => 'system',
34+
default => 'root'
35+
}
36+
3037
$pip_lookup_path = $facts['os']['family'] ? {
3138
'AIX' => [ '/bin', '/usr/bin', '/usr/local/bin', '/opt/freeware/bin/' ],
3239
default => [ '/bin', '/usr/bin', '/usr/local/bin' ]
3340
}
3441

35-
$gunicorn_package_name = $::osfamily ? {
42+
$gunicorn_package_name = $facts['os']['family'] ? {
3643
'RedHat' => 'python-gunicorn',
3744
default => 'gunicorn',
3845
}

manifests/pip.pp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
#
32
# @summary Installs and manages packages from pip.
43
#
54
# @param name must be unique
@@ -56,7 +55,7 @@
5655
Enum['pip', 'pip3'] $pip_provider = 'pip',
5756
Variant[Boolean, String] $url = false,
5857
String[1] $owner = 'root',
59-
String[1] $group = 'root',
58+
$group = undef,
6059
$umask = undef,
6160
$index = false,
6261
Variant[Boolean, String] $proxy = false,
@@ -69,10 +68,15 @@
6968
Numeric $timeout = 1800,
7069
String[1] $log_dir = '/tmp',
7170
Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'],
72-
) {
71+
){
7372
$python_provider = getparam(Class['python'], 'provider')
7473
$python_version = getparam(Class['python'], 'version')
75-
74+
if $group {
75+
$_group = $group
76+
} else {
77+
include ::python::params
78+
$_group = $python::params::group
79+
}
7680
# Get SCL exec prefix
7781
# NB: this will not work if you are running puppet from scl enabled shell
7882
$exec_prefix = $python_provider ? {
@@ -184,7 +188,7 @@
184188
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} ;}",
185189
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}",
186190
user => $owner,
187-
group => $group,
191+
group => $_group,
188192
umask => $umask,
189193
cwd => $cwd,
190194
environment => $environment,
@@ -196,7 +200,7 @@
196200
command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${install_args} ${pip_common_args} ;}",
197201
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}",
198202
user => $owner,
199-
group => $group,
203+
group => $_group,
200204
umask => $umask,
201205
cwd => $cwd,
202206
environment => $environment,
@@ -213,7 +217,7 @@
213217
command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}==${ensure} || ${pip_install} ${install_args} ${pip_common_args}==${ensure} ;}",
214218
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}",
215219
user => $owner,
216-
group => $group,
220+
group => $_group,
217221
umask => $umask,
218222
cwd => $cwd,
219223
environment => $environment,
@@ -228,7 +232,7 @@
228232
command => "${wheel_check} ; { ${pip_install} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${pip_common_args} ;}",
229233
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}",
230234
user => $owner,
231-
group => $group,
235+
group => $_group,
232236
umask => $umask,
233237
cwd => $cwd,
234238
environment => $environment,
@@ -259,7 +263,7 @@
259263
command => "${wheel_check} ; { ${pip_install} --upgrade \$wheel_support_flag ${pip_common_args} || ${pip_install} --upgrade ${pip_common_args} ;}",
260264
unless => $unless_command,
261265
user => $owner,
262-
group => $group,
266+
group => $_group,
263267
umask => $umask,
264268
cwd => $cwd,
265269
environment => $environment,
@@ -274,7 +278,7 @@
274278
command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}",
275279
onlyif => "${pip_env} freeze --all | grep -i -e ${grep_regex}",
276280
user => $owner,
277-
group => $group,
281+
group => $_group,
278282
umask => $umask,
279283
cwd => $cwd,
280284
environment => $environment,

0 commit comments

Comments
 (0)