Skip to content

Commit

Permalink
Merge pull request voxpupuli#955 from wyardley/daemon_off
Browse files Browse the repository at this point in the history
Allow setting $daemon to "on" or "off" (defaults to unset)
  • Loading branch information
bastelfreak authored Oct 31, 2016
2 parents 93a20a9 + 6aa0a81 commit ca19e43
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
$client_body_buffer_size = '128k',
$client_max_body_size = '10m',
$client_body_timeout = '60',
$daemon = undef,
$send_timeout = '60',
$lingering_timeout = '5',
$events_use = false,
Expand Down Expand Up @@ -277,6 +278,10 @@
owner => $daemon_user,
}

if ($daemon) {
validate_re($daemon, '^(on|off)$')
}

file {$proxy_temp_path:
ensure => directory,
owner => $daemon_user,
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
$client_body_temp_path = undef,
$client_max_body_size = undef,
$events_use = undef,
$daemon = undef,
$fastcgi_cache_inactive = undef,
$fastcgi_cache_key = undef,
$fastcgi_cache_keys_zone = undef,
Expand Down Expand Up @@ -304,6 +305,7 @@
sites_available_owner => $sites_available_owner,
sites_available_group => $sites_available_group,
sites_available_mode => $sites_available_mode,
daemon => $daemon,
}
}

Expand Down
18 changes: 18 additions & 0 deletions spec/classes/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,24 @@
value: 'test-user',
match: 'user test-user;'
},
{
title: 'should not set daemon',
attr: 'daemon',
value: :undef,
notmatch: %r{^\s*daemon\s+}
},
{
title: 'should set daemon on',
attr: 'daemon',
value: 'on',
match: %r{^daemon\s+on;$}
},
{
title: 'should set daemon off',
attr: 'daemon',
value: 'off',
match: %r{^daemon\s+off;$}
},
{
title: 'should set worker_processes',
attr: 'worker_processes',
Expand Down
3 changes: 3 additions & 0 deletions templates/conf.d/nginx.conf.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# MANAGED BY PUPPET
<% if @daemon -%>
daemon <%= @daemon %>;
<% end -%>
<% if @super_user -%>
user <%= @daemon_user %>;
<% end -%>
Expand Down

0 comments on commit ca19e43

Please sign in to comment.