Skip to content

Commit d53eba8

Browse files
committed
Don't insert the address option if not specified.
The previous default made rsyncd an IPv4 only service by default. This change instead uses the rsyncd default when unset. This easily allows dual stack services to provide rsyncd.
1 parent 4ff5dca commit d53eba8

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
$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',
@@ -43,12 +43,17 @@
4343
if $use_xinetd {
4444
include xinetd
4545
xinetd::service { 'rsync':
46-
bind => $address,
4746
port => '873',
4847
server => '/usr/bin/rsync',
4948
server_args => "--daemon --config ${conf_file}",
5049
require => Package['rsync'],
5150
}
51+
52+
if ($address != 'UNSET') {
53+
Xinetd::Service['rsync'] {
54+
bind => $address,
55+
}
56+
}
5257
} else {
5358
if ($facts['os']['family'] == 'RedHat') and
5459
(Integer($facts['os']['release']['major']) >= 8) and

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)