Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various tidying up #246

Merged
merged 2 commits into from
Sep 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 33 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,15 +56,25 @@
}

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 {
pip: {
# Install pip without pip, see https://pip.pypa.io/en/stable/installing/.
exec { 'bootstrap pip':
command => 'curl https://bootstrap.pypa.io/get-pip.py | python',
creates => '/usr/local/bin/pip',
require => Package['python'],
}
Exec['bootstrap pip'] -> Package <| provider == pip |>

Package <| title == 'pip' |> {
name => 'pip',
provider => 'pip',
Expand All @@ -79,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 @@ -101,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 @@ -128,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 @@ -143,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 @@ -180,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,
}
}
}