Skip to content

Commit 0dd5010

Browse files
committed
split tests for Debian and Ubuntu
relying on Ubuntu full containing the month number works fine for specific versions, but makes it hard to use versioncmp. this patch does not change behaviour
1 parent fa8305c commit 0dd5010

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

manifests/config.pp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,22 @@
3333
}
3434
}
3535
'Debian': {
36-
if $facts['os']['release']['major'] == '12' {
37-
$daemon_config = '/etc/ntpsec/ntp.conf'
36+
if $facts['os']['name'] == 'Ubuntu' {
37+
if $ntp::user and $facts['os']['release']['major'] == '18.04' {
38+
file_line { 'Set NTPD daemon user':
39+
ensure => present,
40+
path => '/usr/lib/ntp/ntp-systemd-wrapper',
41+
line => "RUNASUSER=${ntp::user}",
42+
match => '^RUNASUSER\=',
43+
}
44+
}
3845
} else {
39-
$daemon_config = '/etc/default/ntp'
46+
# Assume all other distros in Debian family follow Debian version numbering
47+
if versioncmp($facts['os']['release']['full'], '12') >= 0 {
48+
$daemon_config = '/etc/ntpsec/ntp.conf'
49+
} else {
50+
$daemon_config = '/etc/default/ntp'
51+
}
4052
}
4153
if $ntp::daemon_extra_opts {
4254
file_line { 'Set NTPD daemon options':
@@ -46,14 +58,6 @@
4658
match => '^NTPD_OPTS\=',
4759
}
4860
}
49-
if $ntp::user and $facts['os']['release']['major'] == '18.04' {
50-
file_line { 'Set NTPD daemon user':
51-
ensure => present,
52-
path => '/usr/lib/ntp/ntp-systemd-wrapper',
53-
line => "RUNASUSER=${ntp::user}",
54-
match => '^RUNASUSER\=',
55-
}
56-
}
5761
}
5862
'Suse': {
5963
$daemon_config = '/etc/sysconfig/ntp'

0 commit comments

Comments
 (0)