Skip to content

Commit

Permalink
Merge pull request voxpupuli#1126 from miksercz/master
Browse files Browse the repository at this point in the history
add settable nginx daemon group
  • Loading branch information
wyardley authored Oct 24, 2017
2 parents fb8d8be + 11e94f4 commit d58f839
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$conf_dir = $::nginx::conf_dir
$daemon = $::nginx::daemon
$daemon_user = $::nginx::daemon_user
$daemon_group = $::nginx::daemon_group
$global_owner = $::nginx::global_owner
$global_group = $::nginx::global_group
$global_mode = $::nginx::global_mode
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
$conf_dir = $::nginx::params::conf_dir,
Optional[Enum['on', 'off']] $daemon = undef,
$daemon_user = $::nginx::params::daemon_user,
$daemon_group = undef,
$global_owner = $::nginx::params::global_owner,
$global_group = $::nginx::params::global_group,
$global_mode = $::nginx::params::global_mode,
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@
value: false,
notmatch: %r{user}
},
{
title: 'should not set group',
attr: 'daemon_group',
value: :undef,
notmatch: %r{^user \S+ \S+;}
},
{
title: 'should set user',
attr: 'daemon_user',
Expand Down Expand Up @@ -1074,6 +1080,12 @@
it { is_expected.to contain_file('/etc/nginx/nginx.conf').with_content %r{^user www-data;} }
end

context 'when daemon_group = test-group' do
let(:params) { { daemon_group: 'test-group' } }

it { is_expected.to contain_file('/etc/nginx/nginx.conf').with_content %r{^user .* test-group;} }
end

context 'when log_dir is non-default' do
let(:params) { { log_dir: '/foo/bar' } }

Expand Down
2 changes: 1 addition & 1 deletion templates/conf.d/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
daemon <%= @daemon %>;
<% end -%>
<% if @super_user -%>
user <%= @daemon_user %>;
user <%= @daemon_user %><% if @daemon_group -%> <%= @daemon_group %><% end -%>;
<% end -%>
worker_processes <%= @worker_processes %>;
<% if @worker_rlimit_nofile -%>
Expand Down

0 comments on commit d58f839

Please sign in to comment.