Skip to content

Commit

Permalink
Merge pull request #257 from traylenator/seven
Browse files Browse the repository at this point in the history
Install systemd-resolved on RedHat 7
  • Loading branch information
ekohl committed Feb 21, 2022
2 parents 0c86202 + 3c32c31 commit f24b7ac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ class{'systemd':
}
```

when `manage_systemd` is true any required sub package, e.g. `systemd-resolved` on CentOS 8, will be installed. However configuration of
when `manage_systemd` is true any required sub package, e.g. `systemd-resolved` on CentOS 9, 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
2 changes: 2 additions & 0 deletions data/RedHat-7.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
systemd::resolved_package: 'systemd-resolved'

systemd::accounting:
DefaultCPUAccounting: 'yes'
DefaultBlockIOAccounting: 'yes'
Expand Down
9 changes: 3 additions & 6 deletions spec/acceptance/resolved_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
}
PUPPET
apply_manifest(pp, catch_failures: true)
# RedHat 9 and newer installs package first run before fact $facts['internal_services'] is set
apply_manifest(pp, catch_failures: true) if Gem::Version.new(fact('os.release.major')) >= Gem::Version.new('9') && (fact('os.family') == 'RedHat')
# 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')
apply_manifest(pp, catch_changes: true)
end

# RedHat 7 does not have systemd-resolved available at all.
describe service('systemd-resolved'), unless: (fact('os.release.major') == '7' and fact('os.family') == 'RedHat') do
describe service('systemd-resolved') do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end
Expand All @@ -34,8 +33,6 @@
}
PUPPET
apply_manifest(pp, catch_failures: true)
# RedHat 9 and newer installs package first run before fact $facts['internal_services'] is set
apply_manifest(pp, catch_failures: true) if Gem::Version.new(fact('os.release.major')) >= Gem::Version.new('9') && (fact('os.family') == 'RedHat')
apply_manifest(pp, catch_changes: true)
end

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 @@ -36,7 +36,7 @@
it { is_expected.not_to contain_file('/etc/systemd/network') }

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

0 comments on commit f24b7ac

Please sign in to comment.