Skip to content

Commit c124213

Browse files
committed
Don't insert the address option if not specified.
1 parent 771aa03 commit c124213

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

manifests/server.pp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
class rsync::server(
1010
Boolean $use_xinetd = true,
11-
$address = '0.0.0.0',
11+
$address = 'UNSET',
1212
$motd_file = 'UNSET',
1313
Variant[Enum['UNSET'], Stdlib::Absolutepath] $pid_file = '/var/run/rsyncd.pid',
1414
$use_chroot = 'yes',
@@ -26,12 +26,17 @@
2626
if $use_xinetd {
2727
include xinetd
2828
xinetd::service { 'rsync':
29-
bind => $address,
3029
port => '873',
3130
server => '/usr/bin/rsync',
3231
server_args => "--daemon --config ${conf_file}",
3332
require => Package['rsync'],
3433
}
34+
35+
if ($address != 'UNSET') {
36+
Xinetd::Service['rsync'] {
37+
bind => $address,
38+
}
39+
}
3540
} else {
3641

3742
# Manage the installation of the rsyncd package?

spec/classes/server_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
describe 'when using default params' do
1010
it {
1111
is_expected.to contain_class('xinetd')
12-
is_expected.to contain_xinetd__service('rsync').with(bind: '0.0.0.0')
12+
is_expected.to contain_xinetd__service('rsync').with(port: 873)
1313
is_expected.not_to contain_service('rsync')
1414
is_expected.not_to contain_file('/etc/rsync-motd')
1515
is_expected.to contain_concat__fragment('rsyncd_conf_header').with(order: '00_header')
1616
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(%r{^use chroot\s*=\s*yes$})
17-
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(%r{^address\s*=\s*0.0.0.0$})
1817
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(%r{^pid file\s*=\s*/var/run/rsyncd.pid$})
1918
}
2019
end
@@ -76,6 +75,7 @@
7675
end
7776

7877
it {
78+
is_expected.to contain_xinetd__service('rsync').with(bind: '10.0.0.42')
7979
is_expected.to contain_concat__fragment('rsyncd_conf_header').with_content(%r{^address\s*=\s*10.0.0.42$})
8080
}
8181
end

templates/header.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ use chroot = <%= @use_chroot %>
1010
log format = %t %a %m %f %b
1111
syslog facility = local3
1212
timeout = 300
13+
<% if @address != 'UNSET' -%>
1314
address = <%= @address %>
15+
<% end -%>
1416
<% if @motd_file != 'UNSET' -%>
1517
motd file = <%= @motd_file %>
1618
<% end -%>

0 commit comments

Comments
 (0)