Skip to content

Commit

Permalink
Merge pull request #246 from joshuaspence/ensure_latest2
Browse files Browse the repository at this point in the history
Various tidying up
  • Loading branch information
Shiva Poudel committed Sep 16, 2015
2 parents 07d6862 + 9bda843 commit 5e73883
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# == Class: python::install
#
# Installs core python packages
# Installs core python packages,
#
# === Examples
#
Expand Down Expand Up @@ -28,20 +28,20 @@
}

$dev_ensure = $python::dev ? {
true => present,
false => absent,
true => 'present',
false => 'absent',
default => $python::dev,
}

$pip_ensure = $python::pip ? {
true => present,
false => absent,
true => 'present',
false => 'absent',
default => $python::pip,
}

$venv_ensure = $python::virtualenv ? {
true => present,
false => absent,
true => 'present',
false => 'absent',
default => $python::virtualenv,
}

Expand All @@ -56,11 +56,13 @@
}

package { 'pip':
ensure => $pip_ensure,
ensure => $pip_ensure,
require => Package['python'],
}

package { 'virtualenv':
ensure => $venv_ensure,
ensure => $venv_ensure,
require => Package['python'],
}

case $python::provider {
Expand All @@ -87,16 +89,16 @@
# enabled using the subscription manager outside of puppet. If CentOS,
# the centos-release-SCL will install the repository.
$install_scl_repo_package = $::operatingsystem ? {
'CentOS' => present,
default => absent,
'CentOS' => 'present',
default => 'absent',
}

package { 'centos-release-SCL':
ensure => $install_scl_repo_package,
before => Package['scl-utils'],
}
package { 'scl-utils':
ensure => latest,
ensure => 'latest',
before => Package['python'],
}

Expand All @@ -109,12 +111,12 @@
ensure => $dev_ensure,
require => Package['scl-utils'],
}
if $pip_ensure {
if $pip_ensure != 'absent' {
exec { 'python-scl-pip-install':
require => Package['scl-utils'],
command => "${python::params::exec_prefix}easy_install pip",
path => ['/usr/bin', '/bin'],
creates => "/opt/rh/${python::version}/root/usr/bin/pip",
require => Package['scl-utils'],
}
}
}
Expand All @@ -136,7 +138,7 @@
tag => 'python-scl-package',
}

if $pip_ensure {
if $pip_ensure != 'absent' {
exec { 'python-scl-pip-install':
command => "${python::exec_prefix}easy_install pip",
path => ['/usr/bin', '/bin'],
Expand All @@ -151,13 +153,13 @@

default: {
if $::osfamily == 'RedHat' {
if $pip_ensure == present {
if $pip_ensure != 'absent' {
if $python::use_epel == true {
include 'epel'
Class['epel'] -> Package['pip']
}
}
if ($venv_ensure == present) and ($::operatingsystemrelease =~ /^6/) {
if ($venv_ensure != 'absent') and ($::operatingsystemrelease =~ /^6/) {
if $python::use_epel == true {
include 'epel'
Class['epel'] -> Package['virtualenv']
Expand Down Expand Up @@ -188,10 +190,13 @@

if $python::manage_gunicorn {
$gunicorn_ensure = $python::gunicorn ? {
true => present,
false => absent,
true => 'present',
false => 'absent',
default => $python::gunicorn,
}
package { 'gunicorn': ensure => $gunicorn_ensure }

package { 'gunicorn':
ensure => $gunicorn_ensure,
}
}
}

0 comments on commit 5e73883

Please sign in to comment.