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

Make sure nobody is trying to make NetworkManager use dhclient in RHEL 10 #1268

Merged
merged 3 commits into from
Aug 6, 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
2 changes: 1 addition & 1 deletion .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
ignore_words_list: ro,fo,couldn,repositor,zeor
skip: "./repos/system_upgrade/common/actors/storagescanner/tests/files/mounts,\
./repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/tests/files/nm_cfg_file_error,\
./repos/system_upgrade/common/actors/networkmanagerreadconfig/tests/files/nm_cfg_file_error,\
./repos/system_upgrade/el8toel9/actors/xorgdrvfact/tests/files/journalctl-xorg-intel,\
./repos/system_upgrade/el8toel9/actors/xorgdrvfact/tests/files/journalctl-xorg-qxl,\
./repos/system_upgrade/el8toel9/actors/xorgdrvfact/tests/files/journalctl-xorg-without-qxl,\
Expand Down
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 not reports


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