leapp-repository/SOURCES/0056-Add-LEAPP_DEVEL_TARGET_OS-devel-environment-var.patch
2025-12-01 09:14:24 +00:00

38 lines
1.5 KiB
Diff

From b2dab41ff9d9492a5e121bbce729ea07a5d41330 Mon Sep 17 00:00:00 2001
From: Matej Matuska <mmatuska@redhat.com>
Date: Mon, 29 Sep 2025 21:19:18 +0200
Subject: [PATCH 56/69] Add LEAPP_DEVEL_TARGET_OS devel environment var
Allow setting the target OS for development purposes. Internally (cannot
be set by the user) the LEAPP_TARGET_OS envar is set, similarly to how
this works other arguments.
Note that this patch only adds the variable and stores it into
LEAPP_TARGET_OS, otherwise it is unhandled.
---
commands/upgrade/util.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/commands/upgrade/util.py b/commands/upgrade/util.py
index dadfe7de..1c88eab8 100644
--- a/commands/upgrade/util.py
+++ b/commands/upgrade/util.py
@@ -221,9 +221,13 @@ def prepare_configuration(args):
if args.enable_experimental_feature:
os.environ['LEAPP_EXPERIMENTAL'] = '1'
+ os.environ["LEAPP_TARGET_OS"] = os.getenv(
+ "LEAPP_DEVEL_TARGET_OS", command_utils.get_distro_id()
+ )
+
os.environ['LEAPP_UNSUPPORTED'] = '0' if os.getenv('LEAPP_UNSUPPORTED', '0') == '0' else '1'
# force no rhsm on non-rhel systems, regardless of whether the binary is there
- if args.no_rhsm or command_utils.get_distro_id() != 'rhel':
+ if args.no_rhsm or os.environ['LEAPP_TARGET_OS'] != 'rhel':
os.environ['LEAPP_NO_RHSM'] = '1'
elif not os.path.exists('/usr/sbin/subscription-manager'):
os.environ['LEAPP_NO_RHSM'] = '1'
--
2.51.1