Skip to content

Commit 4f217f4

Browse files
committed
Make serveradmin an optional parameter and use it
Since fc6cced the parameter no longer ends up in the main configuration. It was still used in apache::mod::shib until 049fd54. Since then it's been unused. This changes it to an optional non-empty string which means it doesn't change the default config, but still allows users to set the ServerAdmin in the main Apache config. Fixes: fc6cced
1 parent a2be9bc commit 4f217f4

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

manifests/init.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@
489489
Boolean $purge_configs = true,
490490
Optional[Boolean] $purge_vhost_dir = undef,
491491
Boolean $purge_vdir = false,
492-
String $serveradmin = 'root@localhost',
492+
Optional[String[1]] $serveradmin = undef,
493493
Enum['On', 'Off', 'on', 'off'] $sendfile = 'On',
494494
Optional[Enum['On', 'Off', 'on', 'off']] $ldap_verify_server_cert = undef,
495495
Optional[String] $ldap_trusted_mode = undef,

spec/classes/apache_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
'purge' => 'false'
4040
).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]')
4141
}
42+
it { is_expected.to contain_file('/etc/apache2/apache2.conf').without_content(%r{ServerAdmin}) }
4243
it {
4344
is_expected.to contain_concat('/etc/apache2/ports.conf').with(
4445
'owner' => 'root', 'group' => 'root',
@@ -83,6 +84,16 @@
8384
it { is_expected.to contain_file('/etc/apache2/apache2.conf').with_content %r{^IncludeOptional "/etc/apache2/conf\.d/\*\.conf"$} }
8485
end
8586

87+
context 'with serveradmin' do
88+
let(:params) do
89+
{
90+
serveradmin: '[email protected]',
91+
}
92+
end
93+
94+
it { is_expected.to contain_file('/etc/apache2/apache2.conf').with_content %r{^ServerAdmin admin@example\.com$} }
95+
end
96+
8697
context 'when specifying slash encoding behaviour' do
8798
let :params do
8899
{ allow_encoded_slashes: 'nodecode' }

templates/httpd.conf.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ TraceEnable <%= scope.call_function('apache::bool2httpd', [@trace_enable]) %>
55

66
ServerName "<%= @servername %>"
77
ServerRoot "<%= @server_root %>"
8+
<%- if @serveradmin -%>
9+
ServerAdmin <%= @serveradmin %>
10+
<%- end -%>
811
PidFile <%= @pidfile %>
912
Timeout <%= @timeout %>
1013
KeepAlive <%= @keepalive %>

0 commit comments

Comments
 (0)