|
1 | 1 | # == Class: python::install |
2 | 2 | # |
3 | | -# Installs core python packages |
| 3 | +# Installs core python packages, |
4 | 4 | # |
5 | 5 | # === Examples |
6 | 6 | # |
|
28 | 28 | } |
29 | 29 |
|
30 | 30 | $dev_ensure = $python::dev ? { |
31 | | - true => present, |
32 | | - false => absent, |
| 31 | + true => 'present', |
| 32 | + false => 'absent', |
33 | 33 | default => $python::dev, |
34 | 34 | } |
35 | 35 |
|
36 | 36 | $pip_ensure = $python::pip ? { |
37 | | - true => present, |
38 | | - false => absent, |
| 37 | + true => 'present', |
| 38 | + false => 'absent', |
39 | 39 | default => $python::pip, |
40 | 40 | } |
41 | 41 |
|
42 | 42 | $venv_ensure = $python::virtualenv ? { |
43 | | - true => present, |
44 | | - false => absent, |
| 43 | + true => 'present', |
| 44 | + false => 'absent', |
45 | 45 | default => $python::virtualenv, |
46 | 46 | } |
47 | 47 |
|
|
56 | 56 | } |
57 | 57 |
|
58 | 58 | package { 'pip': |
59 | | - ensure => $pip_ensure, |
| 59 | + ensure => $pip_ensure, |
| 60 | + require => Package['python'], |
60 | 61 | } |
61 | 62 |
|
62 | 63 | package { 'virtualenv': |
63 | | - ensure => $venv_ensure, |
| 64 | + ensure => $venv_ensure, |
| 65 | + require => Package['python'], |
64 | 66 | } |
65 | 67 |
|
66 | 68 | case $python::provider { |
|
87 | 89 | # enabled using the subscription manager outside of puppet. If CentOS, |
88 | 90 | # the centos-release-SCL will install the repository. |
89 | 91 | $install_scl_repo_package = $::operatingsystem ? { |
90 | | - 'CentOS' => present, |
91 | | - default => absent, |
| 92 | + 'CentOS' => 'present', |
| 93 | + default => 'absent', |
92 | 94 | } |
93 | 95 |
|
94 | 96 | package { 'centos-release-SCL': |
95 | 97 | ensure => $install_scl_repo_package, |
96 | 98 | before => Package['scl-utils'], |
97 | 99 | } |
98 | 100 | package { 'scl-utils': |
99 | | - ensure => latest, |
| 101 | + ensure => 'latest', |
100 | 102 | before => Package['python'], |
101 | 103 | } |
102 | 104 |
|
|
109 | 111 | ensure => $dev_ensure, |
110 | 112 | require => Package['scl-utils'], |
111 | 113 | } |
112 | | - if $pip_ensure { |
| 114 | + if $pip_ensure != 'absent' { |
113 | 115 | exec { 'python-scl-pip-install': |
114 | | - require => Package['scl-utils'], |
115 | 116 | command => "${python::params::exec_prefix}easy_install pip", |
116 | 117 | path => ['/usr/bin', '/bin'], |
117 | 118 | creates => "/opt/rh/${python::version}/root/usr/bin/pip", |
| 119 | + require => Package['scl-utils'], |
118 | 120 | } |
119 | 121 | } |
120 | 122 | } |
|
136 | 138 | tag => 'python-scl-package', |
137 | 139 | } |
138 | 140 |
|
139 | | - if $pip_ensure { |
| 141 | + if $pip_ensure != 'absent' { |
140 | 142 | exec { 'python-scl-pip-install': |
141 | 143 | command => "${python::exec_prefix}easy_install pip", |
142 | 144 | path => ['/usr/bin', '/bin'], |
|
151 | 153 |
|
152 | 154 | default: { |
153 | 155 | if $::osfamily == 'RedHat' { |
154 | | - if $pip_ensure == present { |
| 156 | + if $pip_ensure != 'absent' { |
155 | 157 | if $python::use_epel == true { |
156 | 158 | include 'epel' |
157 | 159 | Class['epel'] -> Package['pip'] |
158 | 160 | } |
159 | 161 | } |
160 | | - if ($venv_ensure == present) and ($::operatingsystemrelease =~ /^6/) { |
| 162 | + if ($venv_ensure != 'absent') and ($::operatingsystemrelease =~ /^6/) { |
161 | 163 | if $python::use_epel == true { |
162 | 164 | include 'epel' |
163 | 165 | Class['epel'] -> Package['virtualenv'] |
|
188 | 190 |
|
189 | 191 | if $python::manage_gunicorn { |
190 | 192 | $gunicorn_ensure = $python::gunicorn ? { |
191 | | - true => present, |
192 | | - false => absent, |
| 193 | + true => 'present', |
| 194 | + false => 'absent', |
193 | 195 | default => $python::gunicorn, |
194 | 196 | } |
195 | | - package { 'gunicorn': ensure => $gunicorn_ensure } |
| 197 | + |
| 198 | + package { 'gunicorn': |
| 199 | + ensure => $gunicorn_ensure, |
| 200 | + } |
196 | 201 | } |
197 | 202 | } |
0 commit comments