Skip to content

Commit

Permalink
Rename unavailable kmod inhibitor envvar
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bocekm committed Feb 21, 2023
1 parent ea63b78 commit fd81fe1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
19 changes: 10 additions & 9 deletions convert2rhel/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
Expand Down
6 changes: 3 additions & 3 deletions convert2rhel/unit_tests/checks_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)

Expand Down

0 comments on commit fd81fe1

Please # to comment.