Skip to content

(CAT-2100) Add support for Debian-12 #717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fixtures:
provision: "https://github.com/puppetlabs/provision.git"
puppet_agent:
repo: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
ref: v4.13.0
ref: v4.21.0
package: "https://github.com/puppetlabs/puppetlabs-package.git"
deploy_pe: "https://github.com/jarretlavallee/puppet-deploy_pe"
sign_cert: "https://github.com/m0dular/sign_cert"
Expand Down
6 changes: 5 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
}
}
'Debian': {
$daemon_config = '/etc/default/ntp'
if $facts['os']['release']['major'] == '12' {
$daemon_config = '/etc/ntpsec/ntp.conf'
} else {
$daemon_config = '/etc/default/ntp'
}
if $ntp::daemon_extra_opts {
file_line { 'Set NTPD daemon options':
ensure => present,
Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"operatingsystem": "Debian",
"operatingsystemrelease": [
"10",
"11"
"11",
"12"
]
},
{
Expand Down
19 changes: 17 additions & 2 deletions spec/acceptance/ntp_user_and_daemon_opts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
else
servicename = if os[:family] == 'sles' && os[:release].start_with?('12', '15')
'ntpd'
elsif os[:family] == 'debian' && os[:release].start_with?('12')
'ntpsec'
else
'ntp'
end
Expand All @@ -25,19 +27,32 @@
'/etc/sysconfig/ntpd'
elsif os[:family] == 'sles'
'/etc/sysconfig/ntp'
elsif os[:family] == 'debian' && os[:release].start_with?('12')
'/etc/ntpsec/ntp.conf'
else
'/etc/default/ntp'
end

if os[:family] == 'debian' && os[:release].start_with?('12')
ntpd_opts_match = %r{(OPTIONS|NTPD_OPTS)='-g -i /var/lib/ntpsec'}
chroot_dir = '/var/lib/ntpsec'
else
ntpd_opts_match = %r{(OPTIONS|NTPD_OPTS)='-g -i /var/lib/ntp'}
chroot_dir = '/var/lib/ntp'
end

describe 'ntp class with daemon options:', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) || (os[:release].start_with?('5') && os[:family] == 'redhat') do
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' }" }
let(:pp) do
"class { 'ntp': service_enable => true, service_ensure => running, service_manage => true, service_name => '#{servicename}', user => 'ntp', daemon_extra_opts => '-g -i #{chroot_dir}' }"
end

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

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

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