From 14a49fb8e120721b1e5c92119bc003e959f2a241 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sat, 20 Jul 2024 23:19:02 +0200 Subject: [PATCH 1/3] NetworkManagerConfig: move from el7toel8 to common We'd like to read and eventually check NetworkManager configuration on upgrade from RHEL 9 to RHEL 10. --- .../{el7toel8 => common}/models/networkmanagerconfig.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename repos/system_upgrade/{el7toel8 => common}/models/networkmanagerconfig.py (100%) diff --git a/repos/system_upgrade/el7toel8/models/networkmanagerconfig.py b/repos/system_upgrade/common/models/networkmanagerconfig.py similarity index 100% rename from repos/system_upgrade/el7toel8/models/networkmanagerconfig.py rename to repos/system_upgrade/common/models/networkmanagerconfig.py From 2f10e3bb2e008665324d99ba8860eea2fa3332e9 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sat, 20 Jul 2024 23:16:47 +0200 Subject: [PATCH 2/3] NetworkManagerReadConfig: move from el7toel8 to common We'd like to read and eventually check NetworkManager configuration on upgrade from RHEL 9 to RHEL 10. --- .github/workflows/codespell.yml | 2 +- .../actors/networkmanagerreadconfig/actor.py | 0 .../libraries/networkmanagerreadconfig.py | 0 .../networkmanagerreadconfig/tests/files/nm_cfg_file_error | 0 .../networkmanagerreadconfig/tests/files/nm_cfg_with_dhcp | 0 .../networkmanagerreadconfig/tests/files/nm_cfg_without_dhcp | 0 .../tests/unit_test_networkmanagerreadconfig.py | 0 7 files changed, 1 insertion(+), 1 deletion(-) rename repos/system_upgrade/{el7toel8 => common}/actors/networkmanagerreadconfig/actor.py (100%) rename repos/system_upgrade/{el7toel8 => common}/actors/networkmanagerreadconfig/libraries/networkmanagerreadconfig.py (100%) rename repos/system_upgrade/{el7toel8 => common}/actors/networkmanagerreadconfig/tests/files/nm_cfg_file_error (100%) rename repos/system_upgrade/{el7toel8 => common}/actors/networkmanagerreadconfig/tests/files/nm_cfg_with_dhcp (100%) rename repos/system_upgrade/{el7toel8 => common}/actors/networkmanagerreadconfig/tests/files/nm_cfg_without_dhcp (100%) rename repos/system_upgrade/{el7toel8 => common}/actors/networkmanagerreadconfig/tests/unit_test_networkmanagerreadconfig.py (100%) diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index c296092899..673cef171e 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -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,\ diff --git a/repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/actor.py b/repos/system_upgrade/common/actors/networkmanagerreadconfig/actor.py similarity index 100% rename from repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/actor.py rename to repos/system_upgrade/common/actors/networkmanagerreadconfig/actor.py diff --git a/repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/libraries/networkmanagerreadconfig.py b/repos/system_upgrade/common/actors/networkmanagerreadconfig/libraries/networkmanagerreadconfig.py similarity index 100% rename from repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/libraries/networkmanagerreadconfig.py rename to repos/system_upgrade/common/actors/networkmanagerreadconfig/libraries/networkmanagerreadconfig.py diff --git a/repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/tests/files/nm_cfg_file_error b/repos/system_upgrade/common/actors/networkmanagerreadconfig/tests/files/nm_cfg_file_error similarity index 100% rename from repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/tests/files/nm_cfg_file_error rename to repos/system_upgrade/common/actors/networkmanagerreadconfig/tests/files/nm_cfg_file_error diff --git a/repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/tests/files/nm_cfg_with_dhcp b/repos/system_upgrade/common/actors/networkmanagerreadconfig/tests/files/nm_cfg_with_dhcp similarity index 100% rename from repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/tests/files/nm_cfg_with_dhcp rename to repos/system_upgrade/common/actors/networkmanagerreadconfig/tests/files/nm_cfg_with_dhcp diff --git a/repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/tests/files/nm_cfg_without_dhcp b/repos/system_upgrade/common/actors/networkmanagerreadconfig/tests/files/nm_cfg_without_dhcp similarity index 100% rename from repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/tests/files/nm_cfg_without_dhcp rename to repos/system_upgrade/common/actors/networkmanagerreadconfig/tests/files/nm_cfg_without_dhcp diff --git a/repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/tests/unit_test_networkmanagerreadconfig.py b/repos/system_upgrade/common/actors/networkmanagerreadconfig/tests/unit_test_networkmanagerreadconfig.py similarity index 100% rename from repos/system_upgrade/el7toel8/actors/networkmanagerreadconfig/tests/unit_test_networkmanagerreadconfig.py rename to repos/system_upgrade/common/actors/networkmanagerreadconfig/tests/unit_test_networkmanagerreadconfig.py From 82aa02bea2ff9688056772b55220d2a2acfb5b08 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sun, 21 Jul 2024 00:05:34 +0200 Subject: [PATCH 3/3] 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 --- .../actors/networkdeprecations/actor.py | 46 +++++++++++++++++++ .../unit_test_networkdeprecations_9to10.py | 25 ++++++++++ 2 files changed, 71 insertions(+) create mode 100644 repos/system_upgrade/el9toel10/actors/networkdeprecations/actor.py create mode 100644 repos/system_upgrade/el9toel10/actors/networkdeprecations/tests/unit_test_networkdeprecations_9to10.py diff --git a/repos/system_upgrade/el9toel10/actors/networkdeprecations/actor.py b/repos/system_upgrade/el9toel10/actors/networkdeprecations/actor.py new file mode 100644 index 0000000000..94868476cf --- /dev/null +++ b/repos/system_upgrade/el9toel10/actors/networkdeprecations/actor.py @@ -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() diff --git a/repos/system_upgrade/el9toel10/actors/networkdeprecations/tests/unit_test_networkdeprecations_9to10.py b/repos/system_upgrade/el9toel10/actors/networkdeprecations/tests/unit_test_networkdeprecations_9to10.py new file mode 100644 index 0000000000..57c09b018c --- /dev/null +++ b/repos/system_upgrade/el9toel10/actors/networkdeprecations/tests/unit_test_networkdeprecations_9to10.py @@ -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