Skip to content

Commit 3c32c31

Browse files
committed
Install systemd-resolved on RedHat 7
Following voxpupuli#246 and voxpupuli#254 systemd-resolved was installed on OS family RedHat 9 only. On RedHat 7 a systemd-resolved package is now installed as it is available. For information it is only RedHat 8 that does not have a systemd-resolved package.
1 parent 0c86202 commit 3c32c31

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class{'systemd':
306306
}
307307
```
308308

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

312312
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.

data/RedHat-7.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
systemd::resolved_package: 'systemd-resolved'
3+
24
systemd::accounting:
35
DefaultCPUAccounting: 'yes'
46
DefaultBlockIOAccounting: 'yes'

spec/acceptance/resolved_spec.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
}
1313
PUPPET
1414
apply_manifest(pp, catch_failures: true)
15-
# RedHat 9 and newer installs package first run before fact $facts['internal_services'] is set
16-
apply_manifest(pp, catch_failures: true) if Gem::Version.new(fact('os.release.major')) >= Gem::Version.new('9') && (fact('os.family') == 'RedHat')
15+
# RedHat 7, 9 and newer installs package first run before fact $facts['internal_services'] is set
16+
apply_manifest(pp, catch_failures: true) if fact('os.release.major') != '8' && (fact('os.family') == 'RedHat')
1717
apply_manifest(pp, catch_changes: true)
1818
end
1919

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

spec/classes/init_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
it { is_expected.not_to contain_file('/etc/systemd/network') }
3737

3838
case [facts[:os]['family'], facts[:os]['release']['major']]
39-
when %w[RedHat 9]
39+
when %w[RedHat 7], %w[RedHat 9]
4040
it { is_expected.to contain_package('systemd-resolved') }
4141
else
4242
it { is_expected.not_to contain_package('systemd-resolved') }

0 commit comments

Comments
 (0)