Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions manifests/gunicorn.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
# [*template*]
# Which ERB template to use. Default: python/gunicorn.erb
#
# [*args*]
# Custom arguments to add in gunicorn config file. Default: []
#
# === Examples
#
# python::gunicorn { 'vhost':
Expand Down Expand Up @@ -83,6 +86,7 @@
$errorlog = false,
$log_level = 'error',
$template = 'python/gunicorn.erb',
$args = [],
) {

# Parameter validation
Expand Down
5 changes: 5 additions & 0 deletions spec/defines/gunicorn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
let(:params) { { :dir => '/srv/testapp', :log_level => 'info' } }
it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(/--log-level=info/) }
end

context 'test-app with custom gunicorn preload arguments' do
let(:params) { { :dir => '/srv/testapp', :args => ['--preload'] } }
it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(/--preload/) }
end
end
end
end
5 changes: 5 additions & 0 deletions templates/gunicorn.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ CONFIG = {
'python': '/usr/bin/python',
<% end -%>
'args': (
<% if @args.any? -%>
<% for arg in @args do -%>
'<%= arg %>',
<% end -%>
<% end -%>
<% if !@virtualenv and !@bind -%>
'--bind=unix:/tmp/gunicorn-<%= @name %>.socket',
<% elsif @virtualenv and !@bind -%>
Expand Down