Skip to content

Commit

Permalink
Merge pull request #357 from traylenator/debian12
Browse files Browse the repository at this point in the history
Support Debian 12
  • Loading branch information
bastelfreak authored Oct 29, 2023
2 parents 5f64bc1 + f341931 commit 6083dd4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class { 'systemd':
}
```

when `manage_systemd` is true any required sub package, e.g. `systemd-resolved` on CentOS 9, will be installed. However configuration of
when `manage_systemd` is true any required sub package, e.g. `systemd-resolved` on CentOS 9 or Debian 12, will be installed. However configuration of
systemd-resolved will only occur on second puppet run after that installation.

This requires [puppetlabs-inifile](https://forge.puppet.com/puppetlabs/inifile), which is only a soft dependency in this module (you need to explicitly install it). Both parameters accept a string or an array.
Expand Down
8 changes: 6 additions & 2 deletions spec/acceptance/resolved_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
require 'spec_helper_acceptance'

describe 'systemd with manage_resolved true' do
has_package = (fact('os.family') == 'RedHat' && fact('os.release.major') != '8') || (fact('os.name') == 'Debian' && fact('os.release.major').to_i >= 12)

context 'configure systemd resolved' do
it 'works idempotently with no errors' do
pp = <<-PUPPET
Expand All @@ -12,15 +14,17 @@
}
PUPPET
apply_manifest(pp, catch_failures: true)
# RedHat 7, 9 and newer installs package first run before fact $facts['internal_services'] is set
apply_manifest(pp, catch_failures: true) if fact('os.release.major') != '8' && (fact('os.family') == 'RedHat')
# RedHat 7, 9, Debian 12 and newer installs package first run before fact $facts['internal_services'] is set
apply_manifest(pp, catch_failures: true) if has_package
apply_manifest(pp, catch_changes: true)
end

describe service('systemd-resolved') do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end

it { expect(package('systemd-resolved')).to be_installed } if has_package
end

context 'configure systemd stopped' do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
end

case [facts[:os]['family'], facts[:os]['release']['major']]
when %w[RedHat 7], %w[RedHat 9]
when %w[RedHat 7], %w[RedHat 9], %w[Debian 12]
it { is_expected.to contain_package('systemd-resolved') }
else
it { is_expected.not_to contain_package('systemd-resolved') }
Expand Down

0 comments on commit 6083dd4

Please sign in to comment.