From f301750c1b6cb9fda79994b14256c3cf7cf5329c Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 22:00:38 -0200 Subject: [PATCH 01/10] Allow pip to work in AIX systems --- manifests/install.pp | 48 ++++++++++++++++++++++++++++++++++---------- manifests/params.pp | 13 +++++++++--- manifests/pip.pp | 24 +++++++++++++--------- 3 files changed, 61 insertions(+), 24 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index e7b52347..5b904bbb 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -12,7 +12,8 @@ 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", @@ -83,7 +84,7 @@ Package <| title == 'virtualenv' |> { name => 'virtualenv', provider => 'pip', - require => Package[$pythondev], + require => Package['python-dev'], } } 'scl': { @@ -177,17 +178,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, } } diff --git a/manifests/params.pp b/manifests/params.pp index b0e095e5..25b27e2c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,5 +1,6 @@ -# @api private -# @summary The python Module default configuration settings. +# == Class: python::params +# +# The python Module default configuration settings. # class python::params { $ensure = 'present' @@ -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'] } @@ -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'] ? { 'RedHat' => 'python-gunicorn', default => 'gunicorn', } diff --git a/manifests/pip.pp b/manifests/pip.pp index 1ac36773..43a9c968 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -1,5 +1,4 @@ -# # @summary Installs and manages packages from pip. # # @param name must be unique @@ -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, @@ -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 + $_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 ? { @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, From 635e9240b82be1f913f76fac5c20221014326dab Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 23:29:54 -0200 Subject: [PATCH 02/10] lint --- manifests/init.pp | 2 +- manifests/install.pp | 2 +- manifests/params.pp | 3 ++- manifests/pip.pp | 5 ++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 7ac93c0b..4d946ebc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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}") } diff --git a/manifests/install.pp b/manifests/install.pp index 5b904bbb..ea2a08ba 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -13,7 +13,7 @@ } $pythondev = $facts['os']['family'] ? { - 'AIX' => "${python}-devel", + 'AIX' => "${python}-devel", 'RedHat' => "${python}-devel", 'Debian' => "${python}-dev", 'Suse' => "${python}-devel", diff --git a/manifests/params.pp b/manifests/params.pp index 25b27e2c..e028dc21 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,4 +1,5 @@ -# == Class: python::params +# @api private +# @summary The python Module default configuration settings. # # The python Module default configuration settings. # diff --git a/manifests/pip.pp b/manifests/pip.pp index 43a9c968..be8c2c8c 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -1,4 +1,4 @@ - +getparam(Class['python'], 'version') # @summary Installs and manages packages from pip. # # @param name must be unique @@ -74,8 +74,7 @@ if $group { $_group = $group } else { - include ::python::params - $_group = $python::params::group + $_group = getparam(Class['python'], 'group') } # Get SCL exec prefix # NB: this will not work if you are running puppet from scl enabled shell From 9239cc208d4daa8594845de2d1921edf71476efd Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 23:50:39 -0200 Subject: [PATCH 03/10] adjust pythondev --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index ea2a08ba..e2749b51 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -84,7 +84,7 @@ Package <| title == 'virtualenv' |> { name => 'virtualenv', provider => 'pip', - require => Package['python-dev'], + require => Package[$pythondev], } } 'scl': { From 55cae980086622ab8eede727b6d01e9ef1f04d14 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 23:55:20 -0200 Subject: [PATCH 04/10] remove the need of _group --- manifests/pip.pp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index be8c2c8c..20193b5c 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -55,7 +55,7 @@ Enum['pip', 'pip3'] $pip_provider = 'pip', Variant[Boolean, String] $url = false, String[1] $owner = 'root', - $group = undef, + $group = getparam(Class['python'], 'group'), $umask = undef, $index = false, Variant[Boolean, String] $proxy = false, @@ -71,11 +71,7 @@ ){ $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') - if $group { - $_group = $group - } else { - $_group = getparam(Class['python'], 'group') - } + # Get SCL exec prefix # NB: this will not work if you are running puppet from scl enabled shell $exec_prefix = $python_provider ? { @@ -187,7 +183,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, @@ -199,7 +195,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, @@ -216,7 +212,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, @@ -231,7 +227,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, @@ -262,7 +258,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, @@ -277,7 +273,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, From 4de7e11295750032c4ccb2435f66151cf7970c1f Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 23:55:37 -0200 Subject: [PATCH 05/10] adjust ::python::version --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index e2749b51..d7af925f 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -180,7 +180,7 @@ default: { case $facts['os']['family'] { 'AIX': { - if "${::python::version}" =~ /^python3/ { #lint:ignore:only_variable_string + if "${python::version}" =~ /^python3/ { #lint:ignore:only_variable_string class { 'python::pip::bootstap': version => 'pip3', } From c070b1d60b9289284defbc41a09d1c2598157332 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Tue, 15 Jan 2019 10:29:22 -0200 Subject: [PATCH 06/10] add operatingsystem to metadata.json --- metadata.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metadata.json b/metadata.json index 3f3f2eaf..e6536cd6 100644 --- a/metadata.json +++ b/metadata.json @@ -15,6 +15,9 @@ "gunicorn" ], "operatingsystem_support": [ + { + "operatingsystem": "AIX" + }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ From 9ac732376ccd5530315e1d954c2ae11bce8d8d20 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Tue, 15 Jan 2019 10:41:05 -0200 Subject: [PATCH 07/10] fix typo --- manifests/pip.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 20193b5c..304b4863 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -1,4 +1,3 @@ -getparam(Class['python'], 'version') # @summary Installs and manages packages from pip. # # @param name must be unique From 7cd9f6d79f61dab4cbcda9757750cd38fa47698c Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Tue, 15 Jan 2019 11:20:11 -0200 Subject: [PATCH 08/10] adjust python version --- manifests/install.pp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index d7af925f..88109484 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -6,10 +6,11 @@ # 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 = $facts['os']['family'] ? { @@ -180,7 +181,7 @@ default: { case $facts['os']['family'] { 'AIX': { - if "${python::version}" =~ /^python3/ { #lint:ignore:only_variable_string + if "${python_version}" =~ /^python3/ { #lint:ignore:only_variable_string class { 'python::pip::bootstap': version => 'pip3', } From 3a3026e6bf548d85ce95140e3a20b8a8d8956bc6 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Tue, 15 Jan 2019 18:51:03 -0200 Subject: [PATCH 09/10] replaced getparam by getvar on retrieving default group --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 304b4863..e2ab11c6 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -54,7 +54,7 @@ Enum['pip', 'pip3'] $pip_provider = 'pip', Variant[Boolean, String] $url = false, String[1] $owner = 'root', - $group = getparam(Class['python'], 'group'), + $group = getvar('python::params::group'), $umask = undef, $index = false, Variant[Boolean, String] $proxy = false, From 0b03102af69bb8357f08b1198cc18b904e638a59 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Thu, 17 Jan 2019 11:42:53 -0200 Subject: [PATCH 10/10] added AIX releases --- metadata.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index e6536cd6..dbf0c3a4 100644 --- a/metadata.json +++ b/metadata.json @@ -16,7 +16,11 @@ ], "operatingsystem_support": [ { - "operatingsystem": "AIX" + "operatingsystem": "AIX", + "operatingsystemrelease": [ + "6100-09-11-1810", + "7100-05-03-1837" + ] }, { "operatingsystem": "CentOS",