File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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':
8386 $errorlog = false ,
8487 $log_level = ' error' ,
8588 $template = ' python/gunicorn.erb' ,
89+ $args = [],
8690) {
8791
8892 # Parameter validation
Original file line number Diff line number Diff line change 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
3136end
Original file line number Diff line number Diff 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 -%>
You can’t perform that action at this time.
0 commit comments