Skip to content

Commit 28b049e

Browse files
authored
Merge pull request voxpupuli#319 from ktech-io/feat/args_in_gunicorn
Add "args" option to gunicorn config
2 parents 88ba5eb + 421cd0c commit 28b049e

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

manifests/gunicorn.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
# [*template*]
4343
# Which ERB template to use. Default: python/gunicorn.erb
4444
#
45+
# [*args*]
46+
# Custom arguments to add in gunicorn config file. Default: []
47+
#
4548
# === Examples
4649
#
4750
# python::gunicorn { 'vhost':
@@ -83,6 +86,7 @@
8386
$errorlog = false,
8487
$log_level = 'error',
8588
$template = 'python/gunicorn.erb',
89+
$args = [],
8690
) {
8791

8892
# Parameter validation

spec/defines/gunicorn_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
let(:params) { { :dir => '/srv/testapp', :log_level => 'info' } }
2727
it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(/--log-level=info/) }
2828
end
29+
30+
context 'test-app with custom gunicorn preload arguments' do
31+
let(:params) { { :dir => '/srv/testapp', :args => ['--preload'] } }
32+
it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(/--preload/) }
33+
end
2934
end
3035
end
3136
end

templates/gunicorn.erb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ CONFIG = {
2424
'python': '/usr/bin/python',
2525
<% end -%>
2626
'args': (
27+
<% if @args.any? -%>
28+
<% for arg in @args do -%>
29+
'<%= arg %>',
30+
<% end -%>
31+
<% end -%>
2732
<% if !@virtualenv and !@bind -%>
2833
'--bind=unix:/tmp/gunicorn-<%= @name %>.socket',
2934
<% elsif @virtualenv and !@bind -%>

0 commit comments

Comments
 (0)