diff --git a/convert2rhel/actions/post_conversion/hostmetering.py b/convert2rhel/actions/post_conversion/hostmetering.py index 4602b6a17..f83e69fcd 100644 --- a/convert2rhel/actions/post_conversion/hostmetering.py +++ b/convert2rhel/actions/post_conversion/hostmetering.py @@ -28,20 +28,16 @@ class ConfigureHostMetering(actions.Action): - """Configure host metering on a machine if it's needed. - - env_var: str - Content of CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable. - """ + """Configure host metering on a machine if it's needed.""" id = "CONFIGURE_HOST_METERING_IF_NEEDED" def run(self): """ - Decide whether to install, enable and start host-metering on the system based on the - CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable. + Decide whether to install, enable and start host-metering on the system based on the setting of + 'configure_host_metering' in /etc/convert2rhel.ini. - Behavior can be controlled CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable: + The behavior can be controlled via the 'configure_host_metering' as follows: - "auto": host-metering will be configured based on the above conditions - "force": forces configuration of host-metering (e.g., even if not running on a hyperscaler) - any other value: Will be ignored and host metering will not be configured. @@ -53,7 +49,7 @@ def run(self): super(ConfigureHostMetering, self).run() warn_deprecated_env("CONVERT2RHEL_CONFIGURE_HOST_METERING") - if not self._check_env_var(): + if not self._check_host_metering_configuration(): return False if system_info.version.major != 7 and tool_opts.configure_host_metering == "auto": @@ -134,46 +130,55 @@ def run(self): return service_running - def _check_env_var(self): - """Check if the env var is set and if it has the right content. If the - content is auto|force, the hostmetering should be configued on the system. + def _check_host_metering_configuration(self): + """Check if host metering has been configured by the user and if the configuration option has the right value. + If the value is auto|force, the host metering should be configured on the system. :return: Return True if the value is equal to auto|force, otherwise False :rtype: bool """ if tool_opts.configure_host_metering is None: - logger.debug("CONVERT2RHEL_CONFIGURE_HOST_METERING was not set. Skipping it.") + logger.debug("Configuration of host metering has not been enabled. Skipping it.") self.add_message( level="INFO", id="CONFIGURE_HOST_METERING_SKIP", title="Did not perform host metering configuration.", - description="CONVERT2RHEL_CONFIGURE_HOST_METERING was not set.", + description="Configuration of host metering has been skipped.", + diagnosis="We haven't detected 'configure_host_metering' in the convert2rhel.ini config file nor" + " the CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable.", ) return False if tool_opts.configure_host_metering not in ("force", "auto"): - logger.debug("Value for environment variable not recognized: {}".format(tool_opts.configure_host_metering)) + logger.debug( + "Unexpected value of 'configure_host_metering' in convert2rhel.ini or the" + " CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable: {}".format( + tool_opts.configure_host_metering + ) + ) self.add_message( level="WARNING", id="UNRECOGNIZED_OPTION_CONFIGURE_HOST_METERING", - title="Unrecognized option in CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable.", - description="Environment variable {env_var} not recognized.".format( - env_var=tool_opts.configure_host_metering + title="Unexpected value of the host metering setting", + diagnosis="Unexpected value of 'configure_host_metering' in convert2rhel.ini or the" + " CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable: {}".format( + tool_opts.configure_host_metering ), - remediations="Set the option to `auto` value if you want to configure host metering.", + description="Host metering will not be configured.", + remediations="Set the option to 'auto' or 'force' if you want to configure host metering.", ) return False if tool_opts.configure_host_metering == "force": logger.warning( - "The `force' option has been used for the CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable." + "You've set the host metering setting to 'force'." " Please note that this option is mainly used for testing and will configure host-metering unconditionally. " " For generic usage please use the 'auto' option." ) self.add_message( level="WARNING", id="FORCED_CONFIGURE_HOST_METERING", - title="The `force' option has been used for the CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable.", + title="Configuration of host metering set to 'force'", description="Please note that this option is mainly used for testing and" " will configure host-metering unconditionally." " For generic usage please use the 'auto' option.", diff --git a/convert2rhel/actions/pre_ponr_changes/backup_system.py b/convert2rhel/actions/pre_ponr_changes/backup_system.py index 97a63f873..17ed907bc 100644 --- a/convert2rhel/actions/pre_ponr_changes/backup_system.py +++ b/convert2rhel/actions/pre_ponr_changes/backup_system.py @@ -192,7 +192,9 @@ def _get_changed_package_files(self): except IOError as err: warn_deprecated_env("CONVERT2RHEL_INCOMPLETE_ROLLBACK") if tool_opts.incomplete_rollback: - logger.debug("Skipping backup of the package files. CONVERT2RHEL_INCOMPLETE_ROLLBACK detected.") + logger.debug( + "You have set the incomplete rollback inhibitor override - skipping backup of" " the package files." + ) # Return empty list results in no backup of the files return data else: diff --git a/convert2rhel/actions/pre_ponr_changes/kernel_modules.py b/convert2rhel/actions/pre_ponr_changes/kernel_modules.py index d99f884ce..06f5f2abd 100644 --- a/convert2rhel/actions/pre_ponr_changes/kernel_modules.py +++ b/convert2rhel/actions/pre_ponr_changes/kernel_modules.py @@ -247,21 +247,21 @@ def run(self): rhel_supported_kmods = self._get_rhel_supported_kmods() unsupported_kmods = self._get_unsupported_kmods(host_kmods, rhel_supported_kmods) - # Check if we have the environment variable set, if we do, send a + # Check if the user has specified that they allow unavailable kmods and if so, print a # warning and return. warn_deprecated_env("CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS") if tool_opts.allow_unavailable_kmods: logger.warning( - "Detected 'CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS' environment variable." - " We will continue the conversion with the following kernel modules unavailable in RHEL:\n" + "You have set the option to allow unavailable kernel modules." + " The conversion will continue with the following kernel modules unavailable in RHEL:\n" "{kmods}\n".format(kmods="\n".join(unsupported_kmods)) ) self.add_message( level="WARNING", id="ALLOW_UNAVAILABLE_KERNEL_MODULES", title="Did not perform the ensure kernel modules compatibility check", - description="Detected 'CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS' environment variable.", - diagnosis="We will continue the conversion with the following kernel modules unavailable in RHEL:\n" + diagnosis="You have set the option to allow unavailable kernel modules.", + description="We will continue the conversion with the following kernel modules unavailable in RHEL:\n" "{kmods}\n".format(kmods="\n".join(unsupported_kmods)), ) return @@ -280,8 +280,8 @@ def run(self): "message persists, you can prevent the modules from loading by following {0} 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(LINK_PREVENT_KMODS_FROM_LOADING), + "To circumvent this check and accept the risk, set the allow_unavailable_kmods inhibitor override in the" + "/etc/convert2rhel.ini config file to true.".format(LINK_PREVENT_KMODS_FROM_LOADING), ) return diff --git a/convert2rhel/actions/system_checks/convert2rhel_latest.py b/convert2rhel/actions/system_checks/convert2rhel_latest.py index e6b4c210a..5fea4275a 100644 --- a/convert2rhel/actions/system_checks/convert2rhel_latest.py +++ b/convert2rhel/actions/system_checks/convert2rhel_latest.py @@ -179,14 +179,14 @@ def run(self): if tool_opts.allow_older_version: diagnosis = ( "You are currently running {} and the latest version of convert2rhel is {}.\n" - "'CONVERT2RHEL_ALLOW_OLDER_VERSION' environment variable detected, continuing conversion".format( + "You have set the option to allow older convert2rhel version, continuing conversion".format( formatted_convert2rhel_version, formatted_available_version ) ) logger.warning(diagnosis) self.add_message( level="WARNING", - id="ALLOW_OLDER_VERSION_ENVIRONMENT_VARIABLE", + id="ALLOW_OLDER_VERSION_OPTION", title="Outdated convert2rhel version detected", description="An outdated convert2rhel version has been detected", diagnosis=diagnosis, @@ -224,7 +224,8 @@ def run(self): formatted_convert2rhel_version, formatted_available_version ) ), - remediations="If you want to disregard this check, then set the environment variable 'CONVERT2RHEL_ALLOW_OLDER_VERSION=1' to continue.", + remediations="If you want to disregard this check, set the allow_older_version inhibitor" + " override in the /etc/convert2rhel.ini config file to true.", ) return diff --git a/convert2rhel/actions/system_checks/is_loaded_kernel_latest.py b/convert2rhel/actions/system_checks/is_loaded_kernel_latest.py index 106902984..5398d8bce 100644 --- a/convert2rhel/actions/system_checks/is_loaded_kernel_latest.py +++ b/convert2rhel/actions/system_checks/is_loaded_kernel_latest.py @@ -69,20 +69,17 @@ def run(self): warn_deprecated_env("CONVERT2RHEL_SKIP_KERNEL_CURRENCY_CHECK") if tool_opts.skip_kernel_currency_check: logger.warning( - "Detected 'CONVERT2RHEL_SKIP_KERNEL_CURRENCY_CHECK' environment variable, we will skip " - "the {} comparison.\n" - "Beware, this could leave your system in a broken state.".format(package_to_check) + "You have set the option to skip the kernel currency check. We will not be checking if the loaded" + " kernel is of the latest version available.\nBeware, this could leave your system in a broken state." ) self.add_message( level="WARNING", id="UNSUPPORTED_SKIP_KERNEL_CURRENCY_CHECK_DETECTED", title="Did not perform the kernel currency check", - description=( - "Detected 'CONVERT2RHEL_SKIP_KERNEL_CURRENCY_CHECK' environment variable, we will skip " - "the {} comparison.\n" - "Beware, this could leave your system in a broken state.".format(package_to_check) - ), + description="We will not be checking if the loaded kernel is of the latest version available." + "\nBeware, this could leave your system in a broken state.", + diagnosis="You have set the option to skip the kernel currency check.", ) return @@ -141,9 +138,9 @@ def run(self): ) ), remediations=( - "Please, check if you have any vendor repositories enabled to proceed with the conversion.\n" - "If you wish to disregard this message, set the environment variable " - "'CONVERT2RHEL_SKIP_KERNEL_CURRENCY_CHECK' to 1." + "Please check if you have any vendor repositories enabled to proceed with the conversion.\n" + "If you wish to disregard this message, set the skip_kernel_currency_check inhibitor override in" + " the /etc/convert2rhel.ini config file to true." ), ) return @@ -184,8 +181,8 @@ def run(self): "To proceed with the conversion, update the kernel version by executing the following step:\n\n" "1. yum install {}-{} -y\n" "2. reboot\n" - "If you wish to ignore this message, set the environment variable " - "'CONVERT2RHEL_SKIP_KERNEL_CURRENCY_CHECK' to 1.".format(package_to_check, latest_kernel) + "If you wish to ignore this message, set the skip_kernel_currency_check inhibitor override in" + " the /etc/convert2rhel.ini config file to true.".format(package_to_check, latest_kernel) ), ) return diff --git a/convert2rhel/actions/system_checks/tainted_kmods.py b/convert2rhel/actions/system_checks/tainted_kmods.py index a289bdf82..5f56293f5 100644 --- a/convert2rhel/actions/system_checks/tainted_kmods.py +++ b/convert2rhel/actions/system_checks/tainted_kmods.py @@ -62,8 +62,9 @@ def run(self): remediations=( "Prevent the modules from loading by following {0}" " and run convert2rhel again to continue with the conversion." - " Although it is not recommended, you can disregard this message by setting the environment variable" - " 'CONVERT2RHEL_TAINTED_KERNEL_MODULE_CHECK_SKIP' to 1. Overriding this check can be dangerous" + " Although it is not recommended, you can disregard this message by setting the" + " tainted_kernel_module_check_skip inhibitor override in the /etc/convert2rhel.ini" + " config file to true. Overriding this check can be dangerous" " so it is recommended that you do a system backup beforehand." " For information on what a tainted kernel module is, please refer to this documentation {1}".format( LINK_PREVENT_KMODS_FROM_LOADING, LINK_TAINTED_KMOD_DOCS @@ -76,9 +77,9 @@ def run(self): level="WARNING", id="SKIP_TAINTED_KERNEL_MODULE_CHECK", title="Skip tainted kernel module check", + diagnosis="You have set the option to skip the tainted kernel module check.", description=( - "Detected 'CONVERT2RHEL_TAINTED_KERNEL_MODULE_CHECK_SKIP' environment variable, we will skip " - "the tainted kernel module check.\n" + "We will ignore results of the check that makes sure no tainted kernel modules are loaded.\n" "Beware, this could leave your system in a broken state." ), ) diff --git a/convert2rhel/cli.py b/convert2rhel/cli.py index a4e83439a..3ae5251b8 100644 --- a/convert2rhel/cli.py +++ b/convert2rhel/cli.py @@ -133,10 +133,8 @@ def _register_options(self): " stored in log files {} and {}. At the end of the conversion, these logs are compared" " to show you what rpm files have been affected by the conversion." " Cannot be used with analyze subcommand." - " The environment variable CONVERT2RHEL_INCOMPLETE_ROLLBACK" - " needs to be set to 1 to use this argument.".format( - utils.rpm.PRE_RPM_VA_LOG_FILENAME, utils.rpm.POST_RPM_VA_LOG_FILENAME - ), + " The incomplete_rollback option needs to be set to true in the /etc/convert2rhel.ini config file to" + " use this argument.".format(utils.rpm.PRE_RPM_VA_LOG_FILENAME, utils.rpm.POST_RPM_VA_LOG_FILENAME), ) self._shared_options_parser.add_argument( "--eus", diff --git a/convert2rhel/toolopts/__init__.py b/convert2rhel/toolopts/__init__.py index 14c685467..c09cbdb8f 100644 --- a/convert2rhel/toolopts/__init__.py +++ b/convert2rhel/toolopts/__init__.py @@ -99,8 +99,8 @@ def _handle_config_conflict(self, config_sources): message = ( "We need to run the 'rpm -Va' command to be able to perform a complete rollback of changes" " done to the system during the pre-conversion analysis. If you accept the risk of an" - " incomplete rollback, set the CONVERT2RHEL_INCOMPLETE_ROLLBACK=1 environment" - " variable. Otherwise, remove the --no-rpm-va option." + " incomplete rollback, set the incomplete_rollback option to true in the /etc/convert2rhel.ini" + " config file. Otherwise, remove the --no-rpm-va option." ) loggerinst.critical(message) diff --git a/convert2rhel/unit_tests/actions/post_conversion/hostmetering_test.py b/convert2rhel/unit_tests/actions/post_conversion/hostmetering_test.py index 6befe3ff2..4d72410f0 100644 --- a/convert2rhel/unit_tests/actions/post_conversion/hostmetering_test.py +++ b/convert2rhel/unit_tests/actions/post_conversion/hostmetering_test.py @@ -213,18 +213,16 @@ def test_configure_host_metering( (None, 0), ("", ""), True, - set( - ( - actions.ActionMessage( - level="WARNING", - id="FORCED_CONFIGURE_HOST_METERING", - title="The `force' option has been used for the CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable.", - description="Please note that this option is mainly used for testing and" - " will configure host-metering unconditionally." - " For generic usage please use the 'auto' option.", - ), - ), - ), + { + actions.ActionMessage( + level="WARNING", + id="FORCED_CONFIGURE_HOST_METERING", + title="Configuration of host metering set to 'force'", + description="Please note that this option is mainly used for testing and" + " will configure host-metering unconditionally." + " For generic usage please use the 'auto' option.", + ) + }, actions.ActionResult(level="SUCCESS", id="SUCCESS"), ), ( @@ -234,17 +232,17 @@ def test_configure_host_metering( (None, 0), ("", ""), None, - set( - ( - actions.ActionMessage( - level="WARNING", - id="UNRECOGNIZED_OPTION_CONFIGURE_HOST_METERING", - title="Unrecognized option in CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable.", - description="Environment variable wrong_env not recognized.", - remediations="Set the option to `auto` value if you want to configure host metering.", - ), - ), - ), + { + actions.ActionMessage( + level="WARNING", + id="UNRECOGNIZED_OPTION_CONFIGURE_HOST_METERING", + title="Unexpected value of the host metering setting", + diagnosis="Unexpected value of 'configure_host_metering' in convert2rhel.ini or the" + " CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable: wrong_env", + description="Host metering will not be configured.", + remediations="Set the option to 'auto' or 'force' if you want to configure host metering.", + ) + }, actions.ActionResult(level="SUCCESS", id="SUCCESS"), ), ( @@ -383,16 +381,16 @@ def test_configure_host_metering_messages_and_results( def test_configure_host_metering_no_env_var(monkeypatch, hostmetering_instance, global_tool_opts): - expected = set( - ( - actions.ActionMessage( - level="INFO", - id="CONFIGURE_HOST_METERING_SKIP", - title="Did not perform host metering configuration.", - description="CONVERT2RHEL_CONFIGURE_HOST_METERING was not set.", - ), - ), - ) + expected = { + actions.ActionMessage( + level="INFO", + id="CONFIGURE_HOST_METERING_SKIP", + title="Did not perform host metering configuration.", + description="Configuration of host metering has been skipped.", + diagnosis="We haven't detected 'configure_host_metering' in the convert2rhel.ini config file nor" + " the CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable.", + ) + } monkeypatch.setattr(hostmetering, "tool_opts", global_tool_opts) hostmetering_instance.run() diff --git a/convert2rhel/unit_tests/actions/pre_ponr_changes/backup_system_test.py b/convert2rhel/unit_tests/actions/pre_ponr_changes/backup_system_test.py index adadd7ee6..aca255c30 100644 --- a/convert2rhel/unit_tests/actions/pre_ponr_changes/backup_system_test.py +++ b/convert2rhel/unit_tests/actions/pre_ponr_changes/backup_system_test.py @@ -223,7 +223,7 @@ def test_get_changed_package_files(self, rpm_va_output, expected, message, caplo def test_get_changed_package_files_missing( self, caplog, tmpdir, monkeypatch, backup_package_files_action, global_tool_opts ): - message = "Skipping backup of the package files. CONVERT2RHEL_INCOMPLETE_ROLLBACK detected." + message = "You have set the incomplete rollback inhibitor override - skipping backup of the package files." monkeypatch.setattr(backup_system, "LOG_DIR", str(tmpdir)) monkeypatch.setenv("CONVERT2RHEL_INCOMPLETE_ROLLBACK", "1") monkeypatch.setattr(toolopts, "tool_opts", global_tool_opts) diff --git a/convert2rhel/unit_tests/actions/pre_ponr_changes/kernel_modules_test.py b/convert2rhel/unit_tests/actions/pre_ponr_changes/kernel_modules_test.py index fe5a7289a..9e3ee44e7 100644 --- a/convert2rhel/unit_tests/actions/pre_ponr_changes/kernel_modules_test.py +++ b/convert2rhel/unit_tests/actions/pre_ponr_changes/kernel_modules_test.py @@ -230,8 +230,8 @@ def test_ensure_compatibility_of_kmods_check_env_and_message( ensure_kernel_modules_compatibility_instance.run() should_be_in_logs = ( - ".*Detected 'CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS' environment variable." - " We will continue the conversion with the following kernel modules unavailable in RHEL:.*" + ".*You have set the option to allow unavailable kernel modules." + " The conversion will continue 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) # cannot assert exact action message contents as the kmods arrangement in the message is not static @@ -239,8 +239,10 @@ def test_ensure_compatibility_of_kmods_check_env_and_message( assert STATUS_CODE["WARNING"] == message.level assert "ALLOW_UNAVAILABLE_KERNEL_MODULES" == message.id assert "Did not perform the ensure kernel modules compatibility check" == message.title - assert "Detected 'CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS' environment variable." in message.description - assert "We will continue the conversion with the following kernel modules unavailable in RHEL:" in message.diagnosis + assert ( + "We will continue the conversion with the following kernel modules unavailable in RHEL:" in message.description + ) + assert "You have set the option to allow unavailable kernel modules." in message.diagnosis @pytest.mark.parametrize( diff --git a/convert2rhel/unit_tests/actions/system_checks/convert2rhel_latest_test.py b/convert2rhel/unit_tests/actions/system_checks/convert2rhel_latest_test.py index 8686df352..af6939898 100644 --- a/convert2rhel/unit_tests/actions/system_checks/convert2rhel_latest_test.py +++ b/convert2rhel/unit_tests/actions/system_checks/convert2rhel_latest_test.py @@ -157,12 +157,12 @@ def test_convert2rhel_latest_outdated_version_inhibitor( level="OVERRIDABLE", id="OUT_OF_DATE", title="Outdated convert2rhel version detected", - description="An outdated convert2rhel version has been detected", diagnosis=( "You are currently running {} and the latest version of convert2rhel is {}.\n" "Only the latest version is supported for conversion.".format(running_version, latest_version) ), - remediations="If you want to disregard this check, then set the environment variable 'CONVERT2RHEL_ALLOW_OLDER_VERSION=1' to continue.", + remediations="If you want to disregard this check, set the allow_older_version inhibitor" + " override in the /etc/convert2rhel.ini config file to true.", ) @pytest.mark.parametrize( @@ -337,7 +337,7 @@ def test_convert2rhel_latest_log_check_env( log_msg = ( "You are currently running {} and the latest version of convert2rhel is {}.\n" - "'CONVERT2RHEL_ALLOW_OLDER_VERSION' environment variable detected, continuing conversion".format( + "You have set the option to allow older convert2rhel version, continuing conversion".format( running_version, latest_version ) ) @@ -769,7 +769,8 @@ def test_convert2rhel_latest_bad_nevra_to_parse_pkg_string( "You are currently running {} and the latest version of convert2rhel is {}.\n" "Only the latest version is supported for conversion.".format(running_version, latest_version) ), - remediations="If you want to disregard this check, then set the environment variable 'CONVERT2RHEL_ALLOW_OLDER_VERSION=1' to continue.", + remediations="If you want to disregard this check, set the allow_older_version inhibitor" + " override in the /etc/convert2rhel.ini config file to true.", ) def test_convert2rhel_latest_unable_to_get_c2r_repofile( diff --git a/convert2rhel/unit_tests/actions/system_checks/is_loaded_kernel_latest_test.py b/convert2rhel/unit_tests/actions/system_checks/is_loaded_kernel_latest_test.py index 10da0b684..b6f8d2f62 100644 --- a/convert2rhel/unit_tests/actions/system_checks/is_loaded_kernel_latest_test.py +++ b/convert2rhel/unit_tests/actions/system_checks/is_loaded_kernel_latest_test.py @@ -372,12 +372,10 @@ def test_is_loaded_kernel_latest_eus_system( "WARNING", "UNSUPPORTED_SKIP_KERNEL_CURRENCY_CHECK_DETECTED", "Did not perform the kernel currency check", - ( - "Detected 'CONVERT2RHEL_SKIP_KERNEL_CURRENCY_CHECK' environment variable, we will skip the kernel-core comparison.\nBeware, this could leave your system in a broken state." - ), - None, + "We will not be checking if the loaded kernel is of the latest version available." + "\nBeware, this could leave your system in a broken state.", + "You have set the option to skip the kernel currency check.", None, - id="Unsupported skip with environment var set to 1", ), ), ) @@ -554,9 +552,9 @@ def test_is_loaded_kernel_latest_unable_to_fetch_kernels( "Please refer to the diagnosis for further information", "Could not find any {0} from repositories to compare against the loaded kernel.", ( - "Please, check if you have any vendor repositories enabled to proceed with the conversion.\n" - "If you wish to disregard this message, set the environment variable " - "'CONVERT2RHEL_SKIP_KERNEL_CURRENCY_CHECK' to 1." + "Please check if you have any vendor repositories enabled to proceed with the conversion.\n" + "If you wish to disregard this message, set the skip_kernel_currency_check inhibitor override in" + " the /etc/convert2rhel.ini config file to true." ), id="Repoquery failure without environment var", ), diff --git a/convert2rhel/unit_tests/actions/system_checks/tainted_kmods_test.py b/convert2rhel/unit_tests/actions/system_checks/tainted_kmods_test.py index adacfddc6..a10543bdd 100644 --- a/convert2rhel/unit_tests/actions/system_checks/tainted_kmods_test.py +++ b/convert2rhel/unit_tests/actions/system_checks/tainted_kmods_test.py @@ -80,8 +80,9 @@ def test_check_tainted_kmods(monkeypatch, command_return, is_error, tainted_kmod remediations=( "Prevent the modules from loading by following {0}" " and run convert2rhel again to continue with the conversion." - " Although it is not recommended, you can disregard this message by setting the environment variable" - " 'CONVERT2RHEL_TAINTED_KERNEL_MODULE_CHECK_SKIP' to 1. Overriding this check can be dangerous" + " Although it is not recommended, you can disregard this message by setting the" + " tainted_kernel_module_check_skip inhibitor override in the /etc/convert2rhel.ini" + " config file to true. Overriding this check can be dangerous" " so it is recommended that you do a system backup beforehand." " For information on what a tainted kernel module is, please refer to this documentation {1}".format( LINK_PREVENT_KMODS_FROM_LOADING, LINK_TAINTED_KMOD_DOCS @@ -141,13 +142,13 @@ def test_check_tainted_kmods_skip(monkeypatch, command_return, is_error, tainted ) ), ), - actions.ActionMessage( + actions.ActionMessage( level="WARNING", id="SKIP_TAINTED_KERNEL_MODULE_CHECK", title="Skip tainted kernel module check", + diagnosis="You have set the option to skip the tainted kernel module check.", description=( - "Detected 'CONVERT2RHEL_TAINTED_KERNEL_MODULE_CHECK_SKIP' environment variable, we will skip " - "the tainted kernel module check.\n" + "We will ignore results of the check that makes sure no tainted kernel modules are loaded.\n" "Beware, this could leave your system in a broken state." ), ), diff --git a/convert2rhel/unit_tests/cli_test.py b/convert2rhel/unit_tests/cli_test.py index e290ba041..f0e9ff146 100644 --- a/convert2rhel/unit_tests/cli_test.py +++ b/convert2rhel/unit_tests/cli_test.py @@ -543,7 +543,10 @@ def test_critical_exit_no_rpm_va_setting(monkeypatch, global_tool_opts, tmpdir): monkeypatch.setattr(sys, "argv", mock_cli_arguments(["--no-rpm-va"])) with pytest.raises( SystemExit, - match="We need to run the 'rpm -Va' command to be able to perform a complete rollback of changes done to the system during the pre-conversion analysis. If you accept the risk of an incomplete rollback, set the CONVERT2RHEL_INCOMPLETE_ROLLBACK=1 environment variable. Otherwise, remove the --no-rpm-va option.", + match="We need to run the 'rpm -Va' command to be able to perform a complete rollback of changes" + " done to the system during the pre-conversion analysis. If you accept the risk of an" + " incomplete rollback, set the incomplete_rollback option to true in the /etc/convert2rhel.ini" + " config file. Otherwise, remove the --no-rpm-va option.", ): cli.CLI() diff --git a/convert2rhel/unit_tests/toolopts/toolopts_test.py b/convert2rhel/unit_tests/toolopts/toolopts_test.py index be73cba02..847a8d3b3 100644 --- a/convert2rhel/unit_tests/toolopts/toolopts_test.py +++ b/convert2rhel/unit_tests/toolopts/toolopts_test.py @@ -333,8 +333,8 @@ def test_handle_config_conflicts_system_exit(config_sources): match=( "We need to run the 'rpm -Va' command to be able to perform a complete rollback of changes" " done to the system during the pre-conversion analysis. If you accept the risk of an" - " incomplete rollback, set the CONVERT2RHEL_INCOMPLETE_ROLLBACK=1 environment" - " variable. Otherwise, remove the --no-rpm-va option." + " incomplete rollback, set the incomplete_rollback option to true in the /etc/convert2rhel.ini" + " config file. Otherwise, remove the --no-rpm-va option." ), ): tool_opts.initialize(config_sources)