Skip to content

Commit d2dd320

Browse files
Fix specs and don't pass 'daemon_extra_opts' to ubuntu-24.04
1 parent b432117 commit d2dd320

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

spec/acceptance/ntp_parameters_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
config = if os[:family] == 'solaris'
2626
'/etc/inet/ntp.conf'
27+
elsif os[:family] == 'ubuntu' && os[:release].start_with?('24')
28+
'/etc/ntpsec/ntp.conf'
2729
else
2830
'/etc/ntp.conf'
2931
end

spec/acceptance/ntp_user_and_daemon_opts_spec.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,26 @@
2929
'/etc/sysconfig/ntp'
3030
elsif os[:family] == 'debian' && os[:release].start_with?('12')
3131
'/etc/ntpsec/ntp.conf'
32+
elsif os[:family] == 'ubuntu' && os[:release].start_with?('24')
33+
'/etc/default/ntpsec'
3234
else
3335
'/etc/default/ntp'
3436
end
3537

36-
if os[:family] == 'debian' && os[:release].start_with?('12')
38+
if os[:family] == 'debian' && os[:release].to_i >= 12
3739
ntpd_opts_match = %r{(OPTIONS|NTPD_OPTS)='-g -i /var/lib/ntpsec'}
38-
chroot_dir = '/var/lib/ntpsec'
40+
chroot_opt = '-i /var/lib/ntpsec'
41+
elsif os[:family] == 'ubuntu' && os[:release].to_f >= 24.04
42+
ntpd_opts_match = %r{(OPTIONS|NTPD_OPTS)='-g '}
43+
chroot_opt = ''
3944
else
4045
ntpd_opts_match = %r{(OPTIONS|NTPD_OPTS)='-g -i /var/lib/ntp'}
41-
chroot_dir = '/var/lib/ntp'
46+
chroot_opt = '-i /var/lib/ntp'
4247
end
4348

4449
describe 'ntp class with daemon options:', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) || (os[:release].start_with?('5') && os[:family] == 'redhat') do
4550
let(:pp) do
46-
"class { 'ntp': service_enable => true, service_ensure => running, service_manage => true, service_name => '#{servicename}', user => 'ntp', daemon_extra_opts => '-g -i #{chroot_dir}' }"
51+
"class { 'ntp': service_enable => true, service_ensure => running, service_manage => true, service_name => '#{servicename}', user => 'ntp', daemon_extra_opts => '-g #{chroot_opt}' }"
4752
end
4853

4954
context 'when run' do

spec/acceptance/preferred_servers_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
config = if os[:family] == 'solaris'
66
'/etc/inet/ntp.conf'
7+
elsif os[:family] == 'ubuntu' && os[:release].start_with?('24')
8+
'/etc/ntpsec/ntp.conf'
79
else
810
'/etc/ntp.conf'
911
end

0 commit comments

Comments
 (0)