Skip to content

Commit 8840918

Browse files
author
Marc Fournier
committed
python::gunicorn - added template parameter
The idea is to be able to use a different template, in case the one provided with the module doesn't fit the user's need.
1 parent 869a8f1 commit 8840918

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,16 @@ Manages Gunicorn virtual hosts.
9090

9191
**environment** — Set ENVIRONMENT variable. Default: none
9292

93+
**template** — Which ERB template to use. Default: python/gunicorn.erb
94+
9395
python::gunicorn { 'vhost':
9496
ensure => present,
9597
virtualenv => '/var/www/project1',
9698
mode => 'wsgi',
9799
dir => '/var/www/project1/current',
98100
bind => 'unix:/tmp/gunicorn.socket',
99101
environment => 'prod',
102+
template => 'python/gunicorn.erb',
100103
}
101104

102105
## Authors

manifests/gunicorn.pp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
# [*environment*]
2626
# Set ENVIRONMENT variable. Default: none
2727
#
28+
# [*template*]
29+
# Which ERB template to use. Default: python/gunicorn.erb
30+
#
2831
# === Examples
2932
#
3033
# python::gunicorn { 'vhost':
@@ -34,6 +37,7 @@
3437
# dir => '/var/www/project1/current',
3538
# bind => 'unix:/tmp/gunicorn.socket',
3639
# environment => 'prod',
40+
# template => 'python/gunicorn.erb',
3741
# }
3842
#
3943
# === Authors
@@ -47,6 +51,7 @@
4751
$dir = false,
4852
$bind = false,
4953
$environment = false,
54+
$template = 'python/gunicorn.erb',
5055
) {
5156

5257
# Parameter validation
@@ -59,7 +64,7 @@
5964
mode => '0644',
6065
owner => 'root',
6166
group => 'root',
62-
content => template('python/gunicorn.erb'),
67+
content => template($template),
6368
}
6469

6570
}

tests/gunicorn.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
dir => '/var/www/project1/current',
1212
bind => 'unix:/tmp/gunicorn.socket',
1313
environment => 'prod',
14+
template => 'python/gunicorn.erb',
1415
}

0 commit comments

Comments
 (0)