From b0f01e73182b55f767404038c7ba594fdc70e45c Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Thu, 10 Oct 2013 15:15:39 +0300 Subject: [PATCH] Fix python 2.6 usage on CentOS 5 --- abusehelper/manifests/init.pp | 28 ++++++++++++---------------- abusesa/manifests/init.pp | 27 ++++++++++----------------- python/manifests/init.pp | 14 +++++++++++++- vsroom/manifests/init.pp | 24 ++++++++++-------------- 4 files changed, 45 insertions(+), 48 deletions(-) diff --git a/abusehelper/manifests/init.pp b/abusehelper/manifests/init.pp index 3ca6aa6..7fe22da 100644 --- a/abusehelper/manifests/init.pp +++ b/abusehelper/manifests/init.pp @@ -16,20 +16,6 @@ class abusehelper { ensure => installed, } } - "centos","redhat": { - case $::operatingsystemrelease { - /^5/: { - package { "python26": - ensure => installed, - } - Python::Setup::Install["/usr/local/src/abusehelper", - "/usr/local/src/idiokit"] { - python => "python2.6", - require => Package["python26"], - } - } - } - } } if !$abusehelper_package { @@ -82,8 +68,18 @@ class abusehelper { require => File["/usr/local/src/idiokit.tar.gz"], before => Python::Setup::Install["/usr/local/src/idiokit"], } - python::setup::install { [ "/usr/local/src/abusehelper", - "/usr/local/src/idiokit", ]: + + if $::operatingsystem in ["CentOS","RedHat"] and versioncmp($::operatingsystemrelease, "6") < 0 { + include python::python26 + python::setup::install { [ "/usr/local/src/abusehelper", + "/usr/local/src/idiokit", ]: + python => "python2.6", + require => Package["python26"], + } + } else { + python::setup::install { [ "/usr/local/src/abusehelper", + "/usr/local/src/idiokit", ]: + } } include user::system diff --git a/abusesa/manifests/init.pp b/abusesa/manifests/init.pp index 0b55f80..e5dfe12 100644 --- a/abusesa/manifests/init.pp +++ b/abusesa/manifests/init.pp @@ -10,22 +10,6 @@ # class abusesa { - case $::operatingsystem { - "centos","redhat": { - case $::operatingsystemrelease { - /^5/: { - package { "python26": - ensure => installed, - } - Python::Setup::Install["/usr/local/src/abusesa"] { - python => "python2.6", - require => Package["python26"], - } - } - } - } - } - if !$abusesa_package { if $abusesa_package_latest { $abusesa_package = $abusesa_package_latest @@ -86,7 +70,16 @@ class abusesa { require => File["/usr/local/src/abusesa.tar.gz"], before => Python::Setup::Install["/usr/local/src/abusesa"], } - python::setup::install { "/usr/local/src/abusesa": } + + if $::operatingsystem in ["CentOS","RedHat"] and versioncmp($::operatingsystemrelease, "6") < 0 { + include python::python26 + python::setup::install { "/usr/local/src/abusesa": + python => "python2.6", + require => Package["python26"], + } + } else { + python::setup::install { "/usr/local/src/abusesa": } + } if $abusesa_botnets { class { "abusehelper::init": diff --git a/python/manifests/init.pp b/python/manifests/init.pp index 47a29e3..1e4d3c6 100644 --- a/python/manifests/init.pp +++ b/python/manifests/init.pp @@ -1,4 +1,3 @@ - # Install python # class python { @@ -22,6 +21,19 @@ class python { } +# Install python 2.6 for RHEL/CentOS 5 +# +class python::python26 { + + if $::operatingsystem in ["CentOS","RedHat"] and versioncmp($::operatingsystemrelease, "6") < 0 { + package { "python26": + ensure => installed, + } + } + +} + + # Install m2crypto module for python. # class python::m2crypto { diff --git a/vsroom/manifests/init.pp b/vsroom/manifests/init.pp index 5d5d9fd..fbd462c 100644 --- a/vsroom/manifests/init.pp +++ b/vsroom/manifests/init.pp @@ -15,19 +15,6 @@ class vsroom($authurl="/collab/?action=authcredentials", $boshurl="/bosh/", $webhosts=undef) { - case $::operatingsystem { - "centos","redhat": { - case $::operatingsystemrelease { - /^5/: { - Python::Setup::Install["/usr/local/src/vsroom"] { - python => "python2.6", - require => Package["python26"], - } - } - } - } - } - if !$vsroom_package { if $vsroom_package_latest { $vsroom_package = $vsroom_package_latest @@ -50,7 +37,16 @@ class vsroom($authurl="/collab/?action=authcredentials", require => File["/usr/local/src/vsroom.tar.gz"], before => Python::Setup::Install["/usr/local/src/vsroom"], } - python::setup::install { "/usr/local/src/vsroom": } + + if $::operatingsystem in ["CentOS","RedHat"] and versioncmp($::operatingsystemrelease, "6") < 0 { + include python::python26 + python::setup::install { "/usr/local/src/vsroom": + python => "python2.6", + require => Package["python26"], + } + } else { + python::setup::install { "/usr/local/src/vsroom": } + } $htdocs = $::operatingsystem ? { "ubuntu" => "/usr/local/share/vsroom/htdocs",