Skip to content

Commit 995ca4e

Browse files
authored
Merge pull request #461 from feltra/make_it_aix_compatible
Allow pip to work in AIX systems
2 parents c7ab354 + 0b03102 commit 995ca4e

File tree

5 files changed

+58
-18
lines changed

5 files changed

+58
-18
lines changed

manifests/init.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
}
6868

6969
# Module compatibility check
70-
$compatible = [ 'Debian', 'RedHat', 'Suse', 'Gentoo' ]
70+
$compatible = [ 'Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX' ]
7171
if ! ($facts['os']['family'] in $compatible) {
7272
fail("Module is not compatible with ${::operatingsystem}")
7373
}

manifests/install.pp

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
#
77
class python::install {
88

9-
$python = $::python::version ? {
9+
$python_version = getparam(Class['python'], 'version')
10+
$python = $python_version ? {
1011
'system' => 'python',
1112
'pypy' => 'pypy',
12-
default => "${python::version}", # lint:ignore:only_variable_string
13+
default => "${python_version}", # lint:ignore:only_variable_string
1314
}
1415

15-
$pythondev = $::osfamily ? {
16+
$pythondev = $facts['os']['family'] ? {
17+
'AIX' => "${python}-devel",
1618
'RedHat' => "${python}-devel",
1719
'Debian' => "${python}-dev",
1820
'Suse' => "${python}-devel",
@@ -177,17 +179,42 @@
177179
}
178180
}
179181
default: {
182+
case $facts['os']['family'] {
183+
'AIX': {
184+
if "${python_version}" =~ /^python3/ { #lint:ignore:only_variable_string
185+
class { 'python::pip::bootstap':
186+
version => 'pip3',
187+
}
188+
} else {
189+
package { 'python-pip':
190+
ensure => $pip_ensure,
191+
require => Package['python'],
192+
provider => 'yum',
193+
}
194+
}
195+
if $pythondev {
196+
package { 'python-dev':
197+
ensure => $dev_ensure,
198+
name => $pythondev,
199+
alias => $pythondev,
200+
provider => 'yum',
201+
}
202+
}
180203

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

186-
if $pythondev {
187-
package { 'python-dev':
188-
ensure => $dev_ensure,
189-
name => $pythondev,
190-
alias => $pythondev,
191218
}
192219
}
193220

manifests/params.pp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# @api private
22
# @summary The python Module default configuration settings.
33
#
4+
# The python Module default configuration settings.
5+
#
46
class python::params {
57
$ensure = 'present'
68
$version = 'system'
@@ -14,6 +16,7 @@
1416
'RedHat' => ['3','27','33'],
1517
'Debian' => ['3', '3.3', '2.7'],
1618
'Suse' => [],
19+
'AIX' => ['python3'],
1720
'Gentoo' => ['2.7', '3.3', '3.4', '3.5']
1821
}
1922

@@ -27,12 +30,17 @@
2730
$use_epel = false
2831
}
2932

33+
$group = $facts['os']['family'] ? {
34+
'AIX' => 'system',
35+
default => 'root'
36+
}
37+
3038
$pip_lookup_path = $facts['os']['family'] ? {
3139
'AIX' => [ '/bin', '/usr/bin', '/usr/local/bin', '/opt/freeware/bin/' ],
3240
default => [ '/bin', '/usr/bin', '/usr/local/bin' ]
3341
}
3442

35-
$gunicorn_package_name = $::osfamily ? {
43+
$gunicorn_package_name = $facts['os']['family'] ? {
3644
'RedHat' => 'python-gunicorn',
3745
default => 'gunicorn',
3846
}

manifests/pip.pp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
#
31
# @summary Installs and manages packages from pip.
42
#
53
# @param name must be unique
@@ -56,7 +54,7 @@
5654
Enum['pip', 'pip3'] $pip_provider = 'pip',
5755
Variant[Boolean, String] $url = false,
5856
String[1] $owner = 'root',
59-
String[1] $group = 'root',
57+
$group = getvar('python::params::group'),
6058
$umask = undef,
6159
$index = false,
6260
Variant[Boolean, String] $proxy = false,
@@ -69,7 +67,7 @@
6967
Numeric $timeout = 1800,
7068
String[1] $log_dir = '/tmp',
7169
Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'],
72-
) {
70+
){
7371
$python_provider = getparam(Class['python'], 'provider')
7472
$python_version = getparam(Class['python'], 'version')
7573

metadata.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
"gunicorn"
1616
],
1717
"operatingsystem_support": [
18+
{
19+
"operatingsystem": "AIX",
20+
"operatingsystemrelease": [
21+
"6100-09-11-1810",
22+
"7100-05-03-1837"
23+
]
24+
},
1825
{
1926
"operatingsystem": "CentOS",
2027
"operatingsystemrelease": [

0 commit comments

Comments
 (0)