leapp-repository/0070-dnflibs.dnfplugin-Drop-deprecated-DNF_PLUGIN_PATH.patch
Matej Matuska b31dbfa161 IPU 8.10 -> 9.9: CTC2 candidate 1
- Requires leapp-framework 6.6+
- Initial implementation of upgrades on systems with configured Software RAID
- Handle multipath device identification in upgrade environment
- Fix upgrade incorrectly resuming during SELinux relabeling
- Fix upgrades on systems with multiple LUKS devices
- Fix upgrades for systems with /boot/efi on a Software RAID
- Fix mount failures for FSTAB entries with the `nofail` option specified
- Fix AVC errors triggered by registration to insight-client during the upgrade
- Install the correct kernel for the source system kernel page size on ARM systems
- Inhibit the upgrade when network devices configured with ifcfg files could depend on NM
- Introduce rhui.obsolete_gpg_keys configuration option for the removal of obsoleted RPM GPG keys of RHUI Cloud providers
- LiveMode: Fix upgrade getting stuck when the `.leapp_upgrade_failed` file exists
- LiveMode: Fix system version determination in the upgrade environment on CentOS Stream
- Fix target system initramfs containing outdated configuration files in some circumstances
- Ensure SELinux is set to permissive mode during the upgrade even when enforcing=1 is set on the kernel cmdline
- Fix source and target distribution names in /etc/migration-results
- Fix upgrades with the RealTime kernel on CentOS Stream
- Detect misconfigured kernel & systemd API mountpoints in FSTAB
- Detect misconfigured /var/run on the source system
- Unify behaviour of upgrades on systems with enabled CRB repositories and explicitly required CRB repositories by user during the upgrade
- Drop the inconsistent report about the use of CRB (unsupported by Red Hat) repositories
- Fix upgrade crashing when dnf repofiles contain URL encoded characters

- Resolves: RHEL-3289, RHEL-17842, RHEL-36249, RHEL-56040, RHEL-56176, RHEL-60060, RHEL-76846, RHEL-104384, RHEL-145136, RHEL-148631, RHEL-162192, RHEL-185508
2026-06-29 13:26:50 +02:00

112 lines
4.0 KiB
Diff

From e84fe5ebffc05e5f44d431ff770c0910131a6343 Mon Sep 17 00:00:00 2001
From: Petr Stodulka <pstodulk@redhat.com>
Date: Tue, 10 Mar 2026 18:24:46 +0100
Subject: [PATCH 070/108] dnflibs.dnfplugin: Drop deprecated DNF_PLUGIN_PATH
This has been deprecated for a long time - dropping it finally to
clean the code a little bit after the moving to a new path.
Signed-off-by: Petr Stodulka <pstodulk@redhat.com>
---
.../common/libraries/dnflibs/dnfplugin.py | 57 +++++++------------
.../common/libraries/dnfplugin.py | 3 +-
2 files changed, 21 insertions(+), 39 deletions(-)
diff --git a/repos/system_upgrade/common/libraries/dnflibs/dnfplugin.py b/repos/system_upgrade/common/libraries/dnflibs/dnfplugin.py
index b0e10054..43179138 100644
--- a/repos/system_upgrade/common/libraries/dnflibs/dnfplugin.py
+++ b/repos/system_upgrade/common/libraries/dnflibs/dnfplugin.py
@@ -14,54 +14,37 @@ from leapp.libraries.stdlib import api, CalledProcessError, config
from leapp.models import DNFWorkaround
DNF_PLUGIN_NAME = 'rhel_upgrade.py'
-_DEDICATED_URL = 'https://access.redhat.com/solutions/7011704'
-
-
-class _DnfPluginPathStr(str):
- _PATHS = {
- "9": os.path.join('/lib/python3.9/site-packages/dnf-plugins', DNF_PLUGIN_NAME),
- "10": os.path.join('/lib/python3.12/site-packages/dnf-plugins', DNF_PLUGIN_NAME),
- }
-
- def __init__(self): # noqa: W0231; pylint: disable=super-init-not-called
- self.data = ""
-
- def _feed(self):
- major = get_target_major_version()
- if major not in _DnfPluginPathStr._PATHS:
- raise KeyError('{} is not a supported target version of RHEL'.format(major))
- self.data = _DnfPluginPathStr._PATHS[major]
-
- def __str__(self):
- self._feed()
- return str(self.data)
-
- def __repr__(self):
- self._feed()
- return repr(self.data)
-
- def lstrip(self, chars=None):
- self._feed()
- return self.data.lstrip(chars)
-
-
-# Deprecated
-DNF_PLUGIN_PATH = _DnfPluginPathStr()
-
DNF_PLUGIN_DATA_NAME = 'dnf-plugin-data.txt'
DNF_PLUGIN_DATA_PATH = os.path.join('/var/lib/leapp', DNF_PLUGIN_DATA_NAME)
DNF_PLUGIN_DATA_LOG_PATH = os.path.join('/var/log/leapp', DNF_PLUGIN_DATA_NAME)
DNF_DEBUG_DATA_PATH = '/var/log/leapp/dnf-debugdata/'
+_DEDICATED_URL = 'https://access.redhat.com/solutions/7011704'
+_DNF_PLUGIN_PATHS = {
+ '9': os.path.join('/lib/python3.9/site-packages/dnf-plugins', DNF_PLUGIN_NAME),
+ '10': os.path.join('/lib/python3.12/site-packages/dnf-plugins', DNF_PLUGIN_NAME),
+}
+
+
+
+
+
+
+
+
def install(target_basedir):
"""
Installs our plugin to the DNF plugins.
"""
+ # NOTE(pstodulk): Keeping KeyError unhandled as this can happen only
+ # for the new major upgrade path.
+ tgt_plugin_path = os.path.join(
+ target_basedir,
+ _DNF_PLUGIN_PATHS[get_target_major_version()].lstrip('/')
+ )
try:
- shutil.copy2(
- api.get_file_path(DNF_PLUGIN_NAME),
- os.path.join(target_basedir, DNF_PLUGIN_PATH.lstrip('/')))
+ shutil.copy2(api.get_file_path(DNF_PLUGIN_NAME), tgt_plugin_path)
except EnvironmentError as e:
api.current_logger().debug('Failed to install DNF plugin', exc_info=True)
raise StopActorExecutionError(
diff --git a/repos/system_upgrade/common/libraries/dnfplugin.py b/repos/system_upgrade/common/libraries/dnfplugin.py
index 713cc34b..19e4d4e2 100644
--- a/repos/system_upgrade/common/libraries/dnfplugin.py
+++ b/repos/system_upgrade/common/libraries/dnfplugin.py
@@ -10,9 +10,8 @@ This shim will be removed in a future version. Please update imports to:
from leapp.libraries.common.dnflibs import dnfplugin as _dnfplugin
from leapp.utils.deprecation import deprecated
-# Re-export constants (not deprecated)
+# Re-export constants
DNF_PLUGIN_NAME = _dnfplugin.DNF_PLUGIN_NAME
-DNF_PLUGIN_PATH = _dnfplugin.DNF_PLUGIN_PATH
DNF_PLUGIN_DATA_NAME = _dnfplugin.DNF_PLUGIN_DATA_NAME
DNF_PLUGIN_DATA_PATH = _dnfplugin.DNF_PLUGIN_DATA_PATH
DNF_PLUGIN_DATA_LOG_PATH = _dnfplugin.DNF_PLUGIN_DATA_LOG_PATH
--
2.54.0