From 6b3f6565e70290da1e02e3945851b430efb02109 Mon Sep 17 00:00:00 2001 From: Michal Hecko Date: Fri, 11 Apr 2025 15:07:49 +0200 Subject: [PATCH 08/37] feat(livemode): remove the use of LEAPP_DEVEL_ENABLE_LIVEMODE The environmental variable has been introduced to prevent accidental execution of livemode. However, in order for users to use the feature, this environmental variable introduced unnecessary friction. Therefore, this patch removes the use of the variable. Instead, whitelisting experimental actors that facilitate livemode should be the only mechanism that is used to enabled/disable the feature. Jira-ref: RHELMISC-10648 --- docs/source/configuring-ipu.md | 3 --- .../libraries/scan_livemode_config.py | 5 ----- .../tests/test_config_scanner.py | 12 ++++-------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/docs/source/configuring-ipu.md b/docs/source/configuring-ipu.md index 6b838b8f..059b72c2 100644 --- a/docs/source/configuring-ipu.md +++ b/docs/source/configuring-ipu.md @@ -52,9 +52,6 @@ The alternative to the --channel leapp option. As a parameter accepts a channel To use development variables, the LEAPP_UNSUPPORTED variable has to be set. ``` -#### LEAPP_DEVEL_ENABLE_LIVE_MODE -If set to `1`, enable the use of the experimental live mode - #### LEAPP_DEVEL_DM_DISABLE_UDEV Setting the environment variable provides a more convenient way of disabling udev support in libdevmapper, dmsetup and LVM2 tools globally without a need to modify any existing configuration settings. This is mostly useful if the system environment does not use udev. diff --git a/repos/system_upgrade/common/actors/livemode/livemode_config_scanner/libraries/scan_livemode_config.py b/repos/system_upgrade/common/actors/livemode/livemode_config_scanner/libraries/scan_livemode_config.py index 57408c23..26fd9d09 100644 --- a/repos/system_upgrade/common/actors/livemode/livemode_config_scanner/libraries/scan_livemode_config.py +++ b/repos/system_upgrade/common/actors/livemode/livemode_config_scanner/libraries/scan_livemode_config.py @@ -11,16 +11,11 @@ DEFAULT_SQUASHFS_PATH = '/var/lib/leapp/live-upgrade.img' def should_scan_config(): is_unsupported = get_env('LEAPP_UNSUPPORTED', '0') == '1' - is_livemode_enabled = get_env('LEAPP_DEVEL_ENABLE_LIVE_MODE', '0') == '1' if not is_unsupported: api.current_logger().debug('Will not scan livemode config - the upgrade is not unsupported.') return False - if not is_livemode_enabled: - api.current_logger().debug('Will not scan livemode config - the live mode is not enabled.') - return False - if not architecture.matches_architecture(architecture.ARCH_X86_64): api.current_logger().debug('Will not scan livemode config - livemode is currently limited to x86_64.') details = 'Live upgrades are currently limited to x86_64 only.' diff --git a/repos/system_upgrade/common/actors/livemode/livemode_config_scanner/tests/test_config_scanner.py b/repos/system_upgrade/common/actors/livemode/livemode_config_scanner/tests/test_config_scanner.py index 8ddde22e..e24aa366 100644 --- a/repos/system_upgrade/common/actors/livemode/livemode_config_scanner/tests/test_config_scanner.py +++ b/repos/system_upgrade/common/actors/livemode/livemode_config_scanner/tests/test_config_scanner.py @@ -29,19 +29,16 @@ EnablementTestCase = namedtuple('EnablementTestCase', ('env_vars', 'arch', 'pkgs @pytest.mark.parametrize( 'case_descr', ( - EnablementTestCase(env_vars={'LEAPP_UNSUPPORTED': '1', 'LEAPP_DEVEL_ENABLE_LIVE_MODE': '1'}, + EnablementTestCase(env_vars={'LEAPP_UNSUPPORTED': '1'}, arch=architecture.ARCH_X86_64, pkgs=('squashfs-tools', ), result=EnablementResult.SCAN_CONFIG), - EnablementTestCase(env_vars={'LEAPP_UNSUPPORTED': '0', 'LEAPP_DEVEL_ENABLE_LIVE_MODE': '1'}, + EnablementTestCase(env_vars={'LEAPP_UNSUPPORTED': '0'}, arch=architecture.ARCH_X86_64, pkgs=('squashfs-tools', ), result=EnablementResult.DO_NOTHING), - EnablementTestCase(env_vars={'LEAPP_UNSUPPORTED': '1', 'LEAPP_DEVEL_ENABLE_LIVE_MODE': '0'}, - arch=architecture.ARCH_X86_64, pkgs=('squashfs-tools', ), - result=EnablementResult.DO_NOTHING), - EnablementTestCase(env_vars={'LEAPP_UNSUPPORTED': '1', 'LEAPP_DEVEL_ENABLE_LIVE_MODE': '1'}, + EnablementTestCase(env_vars={'LEAPP_UNSUPPORTED': '1'}, arch=architecture.ARCH_ARM64, pkgs=('squashfs-tools', ), result=EnablementResult.RAISE), - EnablementTestCase(env_vars={'LEAPP_UNSUPPORTED': '1', 'LEAPP_DEVEL_ENABLE_LIVE_MODE': '1'}, + EnablementTestCase(env_vars={'LEAPP_UNSUPPORTED': '1'}, arch=architecture.ARCH_ARM64, pkgs=tuple(), result=EnablementResult.RAISE), ) @@ -52,7 +49,6 @@ def test_enablement_conditions(monkeypatch, case_descr): Enablement conditions: - LEAPP_UNSUPPORTED=1 - - LEAPP_DEVEL_ENABLE_LIVE_MODE=1 Not meeting enablement conditions should prevent config message from being produced. -- 2.49.0