leapp-repository/SOURCES/0049-Read-the-DNF-config-by-module.py-library.patch
2025-07-21 11:47:55 +00:00

47 lines
1.8 KiB
Diff

From be6d23241e6fbe0c42a4f6a2df48efd6f999ed71 Mon Sep 17 00:00:00 2001
From: karolinku <kkula@redhat.com>
Date: Thu, 3 Jul 2025 13:12:32 +0200
Subject: [PATCH 49/66] Read the DNF config by module.py library
The DNF configuration has not been loaded when trying to get
information about available module streams (library module.py).
This causes a traceback e.g. on systems which must access DNF
repositories via a proxy.
This patch introduces loading the DNF configuration before trying
to access remote resources.
Jira: RHEL-39095
---
.../common/actors/rpmscanner/libraries/rpmscanner.py | 2 ++
repos/system_upgrade/common/libraries/module.py | 1 +
2 files changed, 3 insertions(+)
diff --git a/repos/system_upgrade/common/actors/rpmscanner/libraries/rpmscanner.py b/repos/system_upgrade/common/actors/rpmscanner/libraries/rpmscanner.py
index dbe56191..74c4b101 100644
--- a/repos/system_upgrade/common/actors/rpmscanner/libraries/rpmscanner.py
+++ b/repos/system_upgrade/common/actors/rpmscanner/libraries/rpmscanner.py
@@ -25,6 +25,8 @@ except ImportError:
def _get_package_repository_data_yum():
yum_base = yum.YumBase()
+ # DNF configuration is not loaded here, since no impact for operations
+ # done by the actor is observed here
pkg_repos = {}
try:
diff --git a/repos/system_upgrade/common/libraries/module.py b/repos/system_upgrade/common/libraries/module.py
index 7d4e8aa4..db725e71 100644
--- a/repos/system_upgrade/common/libraries/module.py
+++ b/repos/system_upgrade/common/libraries/module.py
@@ -38,6 +38,7 @@ def _create_or_get_dnf_base(base=None):
conf.substitutions.update_from_etc('/')
base = dnf.Base(conf=conf)
+ base.conf.read()
base.init_plugins()
base.read_all_repos()
# configure plugins after the repositories are loaded
--
2.50.1