diff --git a/README.md b/README.md index a08c304a..d375e10e 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/spec/acceptance/resolved_spec.rb b/spec/acceptance/resolved_spec.rb index 146b42b3..3f2776e9 100644 --- a/spec/acceptance/resolved_spec.rb +++ b/spec/acceptance/resolved_spec.rb @@ -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 @@ -12,8 +14,8 @@ } 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 @@ -21,6 +23,8 @@ 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 diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 4344ffa2..fcc09152 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -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') }