File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8080 $access_log_format = false ,
8181 $accesslog = false ,
8282 $errorlog = false ,
83+ $loglevel = ' error' ,
8384 $template = ' python/gunicorn.erb' ,
8485) {
8586
8889 fail(' python::gunicorn: dir parameter must not be empty' )
8990 }
9091
92+ validate_re($loglevel , ' debug|info|warning|error|critical' , " Invalid \$ loglevel value ${loglevel} " )
93+
9194 file { "/etc/gunicorn.d/${name}" :
9295 ensure => $ensure ,
9396 mode => ' 0644' ,
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe 'python::gunicorn' , type : :define do
4+ let ( :title ) { 'test-app' }
5+ context 'on Debian OS' do
6+ let :facts do
7+ {
8+ id : 'root' ,
9+ kernel : 'Linux' ,
10+ lsbdistcodename : 'squeeze' ,
11+ osfamily : 'Debian' ,
12+ operatingsystem : 'Debian' ,
13+ operatingsystemrelease : '6' ,
14+ path : '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' ,
15+ concat_basedir : '/dne'
16+ }
17+ end
18+
19+ describe 'gunicorn as' do
20+ context 'configures test app with default parameter values' do
21+ let ( :params ) { { dir : '/srv/testapp' } }
22+ it { is_expected . to contain_file ( '/etc/gunicorn.d/test-app' ) . with_mode ( '0644' ) . with_content ( /--log-level=error/ ) }
23+ end
24+
25+ context 'configures test app with custom log level' do
26+ let ( :params ) { { dir : '/srv/testapp' , loglevel : 'info' } }
27+ it { is_expected . to contain_file ( '/etc/gunicorn.d/test-app' ) . with_mode ( '0644' ) . with_content ( /--log-level=info/ ) }
28+ end
29+ end
30+ end
31+ end
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ CONFIG = {
4242<% if @errorlog -%>
4343 '--error-logfile=<%= @errorlog %> ',
4444<% end -%>
45+ <% if @loglevel %>
46+ '--log-level=<%= @loglevel %> ',
47+ <% end -%>
4548<% if @mode != 'django' -%>
4649 '<%= @appmodule %> ',
4750<% end -%>
You can’t perform that action at this time.
0 commit comments