Skip to content

Commit

Permalink
Merge pull request #717 from puppetlabs/CAT-2100-add-debian12-support
Browse files Browse the repository at this point in the history
(CAT-2100) Add support for Debian-12
  • Loading branch information
shubhamshinde360 authored Oct 24, 2024
2 parents 7d0201d + 0b195a2 commit 7879faa
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
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

0 comments on commit 7879faa

Please sign in to comment.