-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
el0toel10: Add actor that scans for deprecated network settings
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
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
repos/system_upgrade/el9toel10/actors/networkdeprecations/actor.py
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,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() |
25 changes: 25 additions & 0 deletions
25
...upgrade/el9toel10/actors/networkdeprecations/tests/unit_test_networkdeprecations_9to10.py
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,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 |