Skip to content

Commit 9bda843

Browse files
author
Joshua Spence
committed
Various tidying
Tidying up after pull request voxpupuli#244.
1 parent c9c9c2d commit 9bda843

1 file changed

Lines changed: 25 additions & 20 deletions

File tree

manifests/install.pp

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# == Class: python::install
22
#
3-
# Installs core python packages
3+
# Installs core python packages,
44
#
55
# === Examples
66
#
@@ -28,20 +28,20 @@
2828
}
2929

3030
$dev_ensure = $python::dev ? {
31-
true => present,
32-
false => absent,
31+
true => 'present',
32+
false => 'absent',
3333
default => $python::dev,
3434
}
3535

3636
$pip_ensure = $python::pip ? {
37-
true => present,
38-
false => absent,
37+
true => 'present',
38+
false => 'absent',
3939
default => $python::pip,
4040
}
4141

4242
$venv_ensure = $python::virtualenv ? {
43-
true => present,
44-
false => absent,
43+
true => 'present',
44+
false => 'absent',
4545
default => $python::virtualenv,
4646
}
4747

@@ -56,11 +56,13 @@
5656
}
5757

5858
package { 'pip':
59-
ensure => $pip_ensure,
59+
ensure => $pip_ensure,
60+
require => Package['python'],
6061
}
6162

6263
package { 'virtualenv':
63-
ensure => $venv_ensure,
64+
ensure => $venv_ensure,
65+
require => Package['python'],
6466
}
6567

6668
case $python::provider {
@@ -87,16 +89,16 @@
8789
# enabled using the subscription manager outside of puppet. If CentOS,
8890
# the centos-release-SCL will install the repository.
8991
$install_scl_repo_package = $::operatingsystem ? {
90-
'CentOS' => present,
91-
default => absent,
92+
'CentOS' => 'present',
93+
default => 'absent',
9294
}
9395

9496
package { 'centos-release-SCL':
9597
ensure => $install_scl_repo_package,
9698
before => Package['scl-utils'],
9799
}
98100
package { 'scl-utils':
99-
ensure => latest,
101+
ensure => 'latest',
100102
before => Package['python'],
101103
}
102104

@@ -109,12 +111,12 @@
109111
ensure => $dev_ensure,
110112
require => Package['scl-utils'],
111113
}
112-
if $pip_ensure {
114+
if $pip_ensure != 'absent' {
113115
exec { 'python-scl-pip-install':
114-
require => Package['scl-utils'],
115116
command => "${python::params::exec_prefix}easy_install pip",
116117
path => ['/usr/bin', '/bin'],
117118
creates => "/opt/rh/${python::version}/root/usr/bin/pip",
119+
require => Package['scl-utils'],
118120
}
119121
}
120122
}
@@ -136,7 +138,7 @@
136138
tag => 'python-scl-package',
137139
}
138140

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

152154
default: {
153155
if $::osfamily == 'RedHat' {
154-
if $pip_ensure == present {
156+
if $pip_ensure != 'absent' {
155157
if $python::use_epel == true {
156158
include 'epel'
157159
Class['epel'] -> Package['pip']
158160
}
159161
}
160-
if ($venv_ensure == present) and ($::operatingsystemrelease =~ /^6/) {
162+
if ($venv_ensure != 'absent') and ($::operatingsystemrelease =~ /^6/) {
161163
if $python::use_epel == true {
162164
include 'epel'
163165
Class['epel'] -> Package['virtualenv']
@@ -188,10 +190,13 @@
188190

189191
if $python::manage_gunicorn {
190192
$gunicorn_ensure = $python::gunicorn ? {
191-
true => present,
192-
false => absent,
193+
true => 'present',
194+
false => 'absent',
193195
default => $python::gunicorn,
194196
}
195-
package { 'gunicorn': ensure => $gunicorn_ensure }
197+
198+
package { 'gunicorn':
199+
ensure => $gunicorn_ensure,
200+
}
196201
}
197202
}

0 commit comments

Comments
 (0)