Skip to content

Commit 9c7366d

Browse files
(CAT-2100) Add Debian 12 support
Adjust configs as per ntpsec which runs on Debian 12 in favour of ntp.
1 parent 39b25d0 commit 9c7366d

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

.fixtures.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fixtures:
66
provision: "https://github.com/puppetlabs/provision.git"
77
puppet_agent:
88
repo: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
9-
ref: v4.13.0
9+
ref: v4.21.0
1010
package: "https://github.com/puppetlabs/puppetlabs-package.git"
1111
deploy_pe: "https://github.com/jarretlavallee/puppet-deploy_pe"
1212
sign_cert: "https://github.com/m0dular/sign_cert"

manifests/config.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
}
3434
}
3535
'Debian': {
36-
$daemon_config = '/etc/default/ntp'
36+
if $facts['os']['release']['major'] == '12' {
37+
$daemon_config = '/etc/ntpsec/ntp.conf'
38+
} else {
39+
$daemon_config = '/etc/default/ntp'
40+
}
3741
if $ntp::daemon_extra_opts {
3842
file_line { 'Set NTPD daemon options':
3943
ensure => present,

metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"operatingsystem": "Debian",
5050
"operatingsystemrelease": [
5151
"10",
52-
"11"
52+
"11",
53+
"12"
5354
]
5455
},
5556
{

spec/acceptance/ntp_user_and_daemon_opts_spec.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
else
1818
servicename = if os[:family] == 'sles' && os[:release].start_with?('12', '15')
1919
'ntpd'
20+
elsif os[:family] == 'debian' && os[:release].start_with?('12')
21+
'ntpsec'
2022
else
2123
'ntp'
2224
end
@@ -25,19 +27,32 @@
2527
'/etc/sysconfig/ntpd'
2628
elsif os[:family] == 'sles'
2729
'/etc/sysconfig/ntp'
30+
elsif os[:family] == 'debian' && os[:release].start_with?('12')
31+
'/etc/ntpsec/ntp.conf'
2832
else
2933
'/etc/default/ntp'
3034
end
35+
36+
if os[:family] == 'debian' && os[:release].start_with?('12')
37+
ntpd_opts_match = %r{(OPTIONS|NTPD_OPTS)='-g -i /var/lib/ntpsec'}
38+
chroot_dir = '/var/lib/ntpsec'
39+
else
40+
ntpd_opts_match = %r{(OPTIONS|NTPD_OPTS)='-g -i /var/lib/ntp'}
41+
chroot_dir = '/var/lib/ntp'
42+
end
43+
3144
describe 'ntp class with daemon options:', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) || (os[:release].start_with?('5') && os[:family] == 'redhat') do
32-
let(:pp) { "class { 'ntp': service_enable => true, service_ensure => running, service_manage => true, service_name => '#{servicename}', user => 'ntp', daemon_extra_opts => '-g -i /var/lib/ntp' }" }
45+
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}' }"
47+
end
3348

3449
context 'when run' do
3550
it 'is successful' do # rubocop:disable RSpec/NoExpectationExample
3651
apply_manifest(pp, catch_failures: true)
3752
end
3853

3954
describe file(config.to_s) do
40-
its(:content) { is_expected.to match(%r{(OPTIONS|NTPD_OPTS)='-g -i /var/lib/ntp'}) }
55+
its(:content) { is_expected.to match(ntpd_opts_match) }
4156
end
4257

4358
if os[:family] == 'redhat' && !os[:release].start_with?('6')

0 commit comments

Comments
 (0)