-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install systemd-networkd package, if any
On Red Hat systems networkd is packaged as systemd-networkd. In particular: * EL7 * EL8/EL9 shipped in EPEL * Fedora since 33
- Loading branch information
Showing
6 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
systemd::networkd_package: systemd-networkd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper_acceptance' | ||
|
||
describe 'systemd with manage_networkd true' do | ||
has_package = fact('os.family') == 'RedHat' | ||
|
||
# On Enterprise Linux 8 & 9 the package is shipped in EPEL | ||
before { install_package(default, 'epel-release') if has_package && %w[8 9].include?(fact('os.release.major')) } | ||
|
||
context 'configure systemd-networkd' do | ||
let(:manifest) do | ||
<<~PUPPET | ||
class { 'systemd': | ||
manage_networkd => true, | ||
} | ||
PUPPET | ||
end | ||
|
||
it 'works idempotently with no errors' do | ||
apply_manifest(manifest, catch_failures: true) | ||
# Package systemd-networkd needs to be installed before fact $facts['internal_services'] is set | ||
apply_manifest(manifest, catch_failures: true) if has_package | ||
apply_manifest(manifest, catch_changes: true) | ||
end | ||
|
||
describe service('systemd-networkd') do | ||
it { is_expected.to be_running } | ||
it { is_expected.to be_enabled } | ||
end | ||
|
||
it { expect(package('systemd-networkd')).to be_installed } if has_package | ||
end | ||
|
||
context 'configure systemd stopped' do | ||
let(:manifest) do | ||
<<~PUPPET | ||
class { 'systemd': | ||
manage_networkd => true, | ||
networkd_ensure => 'stopped', | ||
} | ||
PUPPET | ||
end | ||
|
||
it 'works idempotently with no errors' do | ||
apply_manifest(manifest, catch_failures: true) | ||
apply_manifest(manifest, catch_changes: true) | ||
end | ||
|
||
describe service('systemd-networkd') do | ||
it { is_expected.not_to be_running } | ||
it { is_expected.not_to be_enabled } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters