Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ipv6 disable check #847

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions definitions/checks/check_ipv6_disable.rb
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
1 change: 1 addition & 0 deletions definitions/scenarios/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def compose
Checks::SystemRegistration,
Checks::CheckHotfixInstalled,
Checks::CheckTmout,
Checks::CheckIpv6Disable,
Checks::CheckUpstreamRepository,
Checks::Disk::AvailableSpace,
Checks::Disk::AvailableSpaceCandlepin, # if candlepin
Expand Down
1 change: 1 addition & 0 deletions definitions/scenarios/upgrade_to_capsule_6_16.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class PreUpgradeCheck < Abstract
def compose
add_steps(find_checks(:default))
add_steps(find_checks(:pre_upgrade))
add_step(Checks::CheckIpv6Disable)
add_step(Checks::Disk::AvailableSpacePostgresql13)
add_step(Checks::Repositories::Validate.new(:version => '6.16'))
end
Expand Down
1 change: 1 addition & 0 deletions definitions/scenarios/upgrade_to_capsule_6_16_z.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class PreUpgradeCheck < Abstract
def compose
add_steps(find_checks(:default))
add_steps(find_checks(:pre_upgrade))
add_step(Checks::CheckIpv6Disable)
add_step(Checks::Repositories::Validate.new(:version => '6.16'))
end
end
Expand Down
1 change: 1 addition & 0 deletions definitions/scenarios/upgrade_to_satellite_6_16.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class PreUpgradeCheck < Abstract
def compose
add_steps(find_checks(:default))
add_steps(find_checks(:pre_upgrade))
add_step(Checks::CheckIpv6Disable)
add_step(Checks::Disk::AvailableSpacePostgresql13)
add_step(Checks::Repositories::Validate.new(:version => '6.16'))
add_step(Checks::CheckOrganizationContentAccessMode)
Expand Down
1 change: 1 addition & 0 deletions definitions/scenarios/upgrade_to_satellite_6_16_z.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class PreUpgradeCheck < Abstract
def compose
add_steps(find_checks(:default))
add_steps(find_checks(:pre_upgrade))
add_step(Checks::CheckIpv6Disable)
add_step(Checks::Repositories::Validate.new(:version => '6.16'))
end
end
Expand Down
21 changes: 21 additions & 0 deletions test/definitions/checks/check_ipv6_disable_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'test_helper'

describe Checks::CheckIpv6Disable do
include DefinitionsTestHelper

subject { Checks::CheckIpv6Disable.new }

it 'throws an error message when ipv6.disable=1 is set' do
File.expects(:read).with('/proc/cmdline').returns('ipv6.disable=1')
result = run_step(subject)

assert result.fail?
end

it 'success when ipv6.disable=1 is not set' do
File.expects(:read).with('/proc/cmdline').returns('test.net=0')
result = run_step(subject)

assert result.success?
end
end
Loading