Skip to content

Commit

Permalink
Merge pull request #319 from ktech-io/feat/args_in_gunicorn
Browse files Browse the repository at this point in the history
Add "args" option to gunicorn config
  • Loading branch information
shivapoudel authored Aug 5, 2016
2 parents 88ba5eb + 421cd0c commit 28b049e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
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

0 comments on commit 28b049e

Please sign in to comment.