-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class Checks::CheckIpv6Disable < ForemanMaintain::Check | ||
metadata do | ||
label :check_ipv6_disable | ||
description 'Check if ipv6.disable=1 is set at kernel level' | ||
end | ||
|
||
def run | ||
cmdline_file = File.read('/proc/cmdline') | ||
|
||
assert(!cmdline_file.include?("ipv6.disable=1"), error_message) | ||
end | ||
|
||
def error_message | ||
base = "\nThe kernel contains ipv6.disable=1 which is known to break installation and upgrade"\ | ||
", remove and reboot before continuining." | ||
|
||
if feature(:instance).downstream | ||
base += " See https://access.redhat.com/solutions/5045841 for more details." | ||
end | ||
|
||
base | ||
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
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
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,32 @@ | ||
require 'test_helper' | ||
|
||
describe Checks::CheckIpv6Disable do | ||
include DefinitionsTestHelper | ||
|
||
subject { Checks::CheckIpv6Disable.new } | ||
|
||
context 'throw an error message when ipv6.disable=1 is set' do | ||
before do | ||
File.expects(:read).with('/proc/cmdline').returns('ipv6.disable=1') | ||
end | ||
|
||
it 'system is self registered' do | ||
result = run_step(subject) | ||
msg = 'test' | ||
|
||
assert result.fail?, msg | ||
end | ||
end | ||
|
||
context 'success when ipv6.disable=1 is not set' do | ||
before do | ||
File.expects(:read).with('/proc/cmdline').returns('test.net=0') | ||
end | ||
|
||
it 'system is self registered' do | ||
result = run_step(subject) | ||
|
||
assert result.success? | ||
end | ||
end | ||
end |