Skip to content

Commit

Permalink
el0toel10: Add actor that scans for deprecated network settings
Browse files Browse the repository at this point in the history
RHEL 10 is going to no longer support configuring NetworkManager
to use the dhclient DHCP client (in fact, dhclient will not
be present at all).

Let's add an actor to deal with this sort of configuration.
In particulare, make sure the users review their configuration,
on chance they configured NM this way intentionally and they
actually rely on some dhclient configuration or behavior.

Jira: https://issues.redhat.com/browse/RHEL-46975
  • Loading branch information
lkundrak committed Jul 30, 2024
1 parent 2f10e3b commit 333f05c
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
46 changes: 46 additions & 0 deletions repos/system_upgrade/el9toel10/actors/networkdeprecations/actor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from leapp import reporting
from leapp.actors import Actor
from leapp.models import NetworkManagerConfig, Report
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag


class CheckNetworkDeprecations9to10(Actor):
"""
Ensures that network configuration doesn't rely on unsupported settings
Inhibits upgrade if the network configuration includes settings that
could possibly not work on the upgraded system.
Includes check for dhclient DHCP plugin that will be removed from RHEL10.
"""

name = "network_deprecations"
consumes = (NetworkManagerConfig,)
produces = (Report,)
tags = (ChecksPhaseTag, IPUWorkflowTag,)

@staticmethod
def report_dhclient():
title = 'Deprecated DHCP plugin configured'
summary = ('NetworkManager is configured to use the "dhclient" DHCP module.'
' In Red Hat Enterprise Linux 10, this setting will be ignored'
' along with any dhcp-client specific configuration.')
remediation = ('Remove "dhcp=internal" line from "[main]" section from all'
' configuration files in "/etc/NetworkManager". Review'
' configuration in "/etc/dhcp", which will be ignored.')
reporting.create_report([
reporting.Title(title),
reporting.Summary(summary),
reporting.Remediation(hint=remediation),
reporting.Severity(reporting.Severity.HIGH),
reporting.Groups([reporting.Groups.NETWORK, reporting.Groups.SERVICES]),
reporting.Groups([reporting.Groups.INHIBITOR]),
reporting.RelatedResource('package', 'dhcp-client'),
reporting.RelatedResource('package', 'NetworkManager'),
])

def process(self):
for nm_config in self.consume(NetworkManagerConfig):
self.log.info('Consuming dhcp={}'.format(nm_config.dhcp))
if nm_config.dhcp == 'dhclient':
CheckNetworkDeprecations9to10.report_dhclient()
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from leapp.models import NetworkManagerConfig, Report


def test_dhcp_dhclient(current_actor_context):
current_actor_context.feed(NetworkManagerConfig(dhcp='dhclient'))
current_actor_context.run()
reports = list(current_actor_context.consume(Report))
assert len(reports) == 1
r = reports[0].report
assert r['title'] == 'Deprecated DHCP plugin configured'
assert r['severity'] == 'high'


def test_dhcp_internal(current_actor_context):
current_actor_context.feed(NetworkManagerConfig(dhcp='internal'))
current_actor_context.run()
reports = list(current_actor_context.consume(Report))
assert len(reports) == 0


def test_dhcp_default(current_actor_context):
current_actor_context.feed(NetworkManagerConfig())
current_actor_context.run()
reports = list(current_actor_context.consume(Report))
assert len(reports) == 0

0 comments on commit 333f05c

Please sign in to comment.