Skip to content

Commit

Permalink
Merge pull request #461 from feltra/make_it_aix_compatible
Browse files Browse the repository at this point in the history
Allow pip to work in AIX systems
  • Loading branch information
bastelfreak authored Jan 18, 2019
2 parents c7ab354 + 0b03102 commit 995ca4e
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 18 deletions.
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}

# Module compatibility check
$compatible = [ 'Debian', 'RedHat', 'Suse', 'Gentoo' ]
$compatible = [ 'Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX' ]
if ! ($facts['os']['family'] in $compatible) {
fail("Module is not compatible with ${::operatingsystem}")
}
Expand Down
51 changes: 39 additions & 12 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
#
class python::install {

$python = $::python::version ? {
$python_version = getparam(Class['python'], 'version')
$python = $python_version ? {
'system' => 'python',
'pypy' => 'pypy',
default => "${python::version}", # lint:ignore:only_variable_string
default => "${python_version}", # lint:ignore:only_variable_string
}

$pythondev = $::osfamily ? {
$pythondev = $facts['os']['family'] ? {
'AIX' => "${python}-devel",
'RedHat' => "${python}-devel",
'Debian' => "${python}-dev",
'Suse' => "${python}-devel",
Expand Down Expand Up @@ -177,17 +179,42 @@
}
}
default: {
case $facts['os']['family'] {
'AIX': {
if "${python_version}" =~ /^python3/ { #lint:ignore:only_variable_string
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
10 changes: 9 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# @api private
# @summary The python Module default configuration settings.
#
# The python Module default configuration settings.
#
class python::params {
$ensure = 'present'
$version = 'system'
Expand All @@ -14,6 +16,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 +30,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'] ? {
'RedHat' => 'python-gunicorn',
default => 'gunicorn',
}
Expand Down
6 changes: 2 additions & 4 deletions manifests/pip.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@

#
# @summary Installs and manages packages from pip.
#
# @param name must be unique
Expand Down Expand Up @@ -56,7 +54,7 @@
Enum['pip', 'pip3'] $pip_provider = 'pip',
Variant[Boolean, String] $url = false,
String[1] $owner = 'root',
String[1] $group = 'root',
$group = getvar('python::params::group'),
$umask = undef,
$index = false,
Variant[Boolean, String] $proxy = false,
Expand All @@ -69,7 +67,7 @@
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')

Expand Down
7 changes: 7 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"gunicorn"
],
"operatingsystem_support": [
{
"operatingsystem": "AIX",
"operatingsystemrelease": [
"6100-09-11-1810",
"7100-05-03-1837"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
Expand Down

0 comments on commit 995ca4e

Please sign in to comment.