Skip to content

Commit 4bb26f1

Browse files
committed
Make the inclusion of the epel class optional.
Without this patch, people in secure environments who are not directly routed to the internet or who mirror their own EPEL repositories cannot use this module as it currently mandates the usage of the epel module. This patch makes that optional and defaults to including it, such that it will continue to work as expected for current users.
1 parent 4caaa64 commit 4bb26f1

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Installs and manages python, python-pip, python-dev, python-virtualenv and Gunic
4242

4343
**manage_gunicorn** - Allow Installation / Removal of Gunicorn. Default: true
4444

45+
**use_epel** - Boolean to determine if the epel class is used. Default: true
46+
4547
```puppet
4648
class { 'python' :
4749
version => 'system',
@@ -278,4 +280,4 @@ python::python_pips:
278280
279281
## Authors
280282
281-
[Sergey Stankevich](https://github.com/stankevich) | [Shiva Poudel](https://github.com/shivapoudel)
283+
[Sergey Stankevich](https://github.com/stankevich) | [Shiva Poudel](https://github.com/shivapoudel) | [Garrett Honeycutt](http://learnpuppet.com)

manifests/init.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
# Default: system default provider
3838
# Allowed values: 'pip'
3939
#
40+
# [*use_epel*]
41+
# Boolean to determine if the epel class is used. Default: true
42+
#
4043
# === Examples
4144
#
4245
# class { 'python':
@@ -50,6 +53,7 @@
5053
# === Authors
5154
#
5255
# Sergey Stankevich
56+
# Garrett Honeycutt <[email protected]>
5357
#
5458
class python (
5559
$version = $python::params::version,
@@ -63,6 +67,7 @@
6367
$python_pips = { },
6468
$python_virtualenvs = { },
6569
$python_pyvenvs = { },
70+
$use_epel = $python::params::use_epel,
6671
) inherits python::params{
6772

6873
# validate inputs
@@ -82,6 +87,7 @@
8287
validate_bool($virtualenv)
8388
validate_bool($gunicorn)
8489
validate_bool($manage_gunicorn)
90+
validate_bool($use_epel)
8591

8692
# Module compatibility check
8793
$compatible = [ 'Debian', 'RedHat', 'Suse' ]

manifests/install.pp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# == Define: python::install
1+
# == Class: python::install
22
#
33
# Installs core python packages
44
#
@@ -11,8 +11,8 @@
1111
# Sergey Stankevich
1212
# Ashley Penney
1313
# Fotis Gimian
14+
# Garrett Honeycutt <[email protected]>
1415
#
15-
1616
class python::install {
1717

1818
$python = $::python::version ? {
@@ -24,7 +24,7 @@
2424
$pythondev = $::osfamily ? {
2525
'RedHat' => "${python}-devel",
2626
'Debian' => "${python}-dev",
27-
'Suse' => "${python}-devel"
27+
'Suse' => "${python}-devel",
2828
}
2929

3030
# pip version: use only for installation via os package manager!
@@ -59,12 +59,16 @@
5959
default: {
6060
if $::osfamily == 'RedHat' {
6161
if $pip_ensure == present {
62-
include 'epel'
63-
Class['epel'] -> Package[$pip]
62+
if $python::use_epel == true {
63+
include 'epel'
64+
Class['epel'] -> Package[$pip]
65+
}
6466
}
6567
if ($venv_ensure == present) and ($::operatingsystemrelease =~ /^6/) {
66-
include 'epel'
67-
Class['epel'] -> Package['python-virtualenv']
68+
if $python::use_epel == true {
69+
include 'epel'
70+
Class['epel'] -> Package['python-virtualenv']
71+
}
6872
}
6973
}
7074
package { 'python-virtualenv': ensure => $venv_ensure }
@@ -81,5 +85,4 @@
8185
}
8286
package { 'gunicorn': ensure => $gunicorn_ensure }
8387
}
84-
8588
}

manifests/params.pp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
2-
# Class: python::params
1+
# == Class: python::params
2+
#
33
# The python Module default configuration settings.
44
#
55
class python::params {
@@ -15,4 +15,5 @@
1515
'Debian' => ['3', '3.3'],
1616
'Suse' => [],
1717
}
18+
$use_epel = true
1819
}

0 commit comments

Comments
 (0)