Skip to content

Commit

Permalink
Add ipv6 disable check
Browse files Browse the repository at this point in the history
(cherry picked from commit e19db77)
  • Loading branch information
ehelms committed May 14, 2024
1 parent 73d1b43 commit c94374c
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
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/upgrade_to_capsule_6_15.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.15'))
end
end
Expand Down
1 change: 1 addition & 0 deletions definitions/scenarios/upgrade_to_capsule_6_15_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.15'))
end
end
Expand Down
1 change: 1 addition & 0 deletions definitions/scenarios/upgrade_to_satellite_6_15.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.15'))
end
end
Expand Down
1 change: 1 addition & 0 deletions definitions/scenarios/upgrade_to_satellite_6_15_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.15'))
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

0 comments on commit c94374c

Please sign in to comment.