From fd81fe12f9eaddfba251b5ea50eba4ff6fc76904 Mon Sep 17 00:00:00 2001 From: Michal Bocek Date: Tue, 21 Feb 2023 14:49:12 +0100 Subject: [PATCH] Rename unavailable kmod inhibitor envvar Before we do an upstream release we can still change the CONVERT2RHEL_ALLOW_UNCHECKED_KMODS environment variable used for overriding the check that inhibits the conversion when kernel modules not available in RHEL are loaded. It is not clear what we mean by the word UNCHECKED. The word UNAVAILABLE is more understandable. Also, the use of "first-party" kernel modules is makes it unclear what we mean by that. --- convert2rhel/checks.py | 19 ++++++++++--------- convert2rhel/unit_tests/checks_test.py | 6 +++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/convert2rhel/checks.py b/convert2rhel/checks.py index 5b2cf881a..bf436eefb 100644 --- a/convert2rhel/checks.py +++ b/convert2rhel/checks.py @@ -369,20 +369,21 @@ def ensure_compatibility_of_kmods(): if not unsupported_kmods: logger.debug("All loaded kernel modules are available in RHEL.") else: - if "CONVERT2RHEL_ALLOW_UNCHECKED_KMODS" in os.environ: + if "CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS" in os.environ: logger.warning( - "Detected 'CONVERT2RHEL_ALLOW_UNCHECKED_KMODS' environment variable." - " We will continue the conversion, with the following kernel modules:\n{kmods}\n".format( - kmods="\n".join(unsupported_kmods) - ) + "Detected 'CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS' environment variable." + " We will continue the conversion with the following kernel modules unavailable in RHEL:\n" + "{kmods}\n".format(kmods="\n".join(unsupported_kmods)) ) else: logger.critical( "The following loaded kernel modules are not available in RHEL:\n{0}\n" - "Kernel modules need to be up-to-date to minimize the risk for issues occurring related to first-party kernel modules.\n" - "Ensure you have updated the kernel to the latest available version and rebooted the system.\n" - "If this message persists, you can prevent the modules from loading by following {1} and rerun convert2rhel.\n" - "To circumvent this check and allow the risk you can set environment variable 'CONVERT2RHEL_ALLOW_UNCHECKED_KMODS=1'.".format( + "Ensure you have updated the kernel to the latest available version and rebooted the system.\nIf this " + "message persists, you can prevent the modules from loading by following {1} and rerun convert2rhel.\n" + "Keeping them loaded could cause the system to malfunction after the conversion as they might not work " + "properly with the RHEL kernel.\n" + "To circumvent this check and accept the risk you can set environment variable " + "'CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS=1'.".format( "\n".join(unsupported_kmods), LINK_PREVENT_KMODS_FROM_LOADING ) ) diff --git a/convert2rhel/unit_tests/checks_test.py b/convert2rhel/unit_tests/checks_test.py index 0f491c215..2372592eb 100644 --- a/convert2rhel/unit_tests/checks_test.py +++ b/convert2rhel/unit_tests/checks_test.py @@ -446,7 +446,7 @@ def test_ensure_compatibility_of_kmods_check_env( caplog, ): - monkeypatch.setattr(os, "environ", {"CONVERT2RHEL_ALLOW_UNCHECKED_KMODS": "1"}) + monkeypatch.setattr(os, "environ", {"CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS": "1"}) monkeypatch.setattr(checks, "get_loaded_kmods", mock.Mock(return_value=HOST_MODULES_STUB_BAD)) run_subprocess_mock = mock.Mock( side_effect=run_subprocess_side_effect( @@ -463,8 +463,8 @@ def test_ensure_compatibility_of_kmods_check_env( checks.ensure_compatibility_of_kmods() should_be_in_logs = ( - ".*Detected 'CONVERT2RHEL_ALLOW_UNCHECKED_KMODS' environment variable." - " We will continue the conversion, with the following kernel modules:.*" + ".*Detected 'CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS' environment variable." + " We will continue the conversion with the following kernel modules unavailable in RHEL:.*" ) assert re.match(pattern=should_be_in_logs, string=caplog.records[-1].message, flags=re.MULTILINE | re.DOTALL)