Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[RHELC-244] Rename unavailable kmod inhibitor envar #745

Merged
merged 1 commit into from
Feb 21, 2023
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
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