Skip to content

Commit a428b7f

Browse files
committed
Reset the dnf base when clearing cache
To reset the repo sack, the whole base must be created anew, because it is not possible to lead repositories multiple times in dnf5.
1 parent d4c82a7 commit a428b7f

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

pyanaconda/modules/payloads/payload/dnf/dnf_manager.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,7 @@ def clear_cache(self):
541541
shutil.rmtree(DNF_CACHE_DIR, ignore_errors=True)
542542
shutil.rmtree(DNF_PLUGINCONF_DIR, ignore_errors=True)
543543

544-
# FIXME: Reset sacks. Should we just drop the base?
545-
# self._base.reset(sack=True, repos=True, goal=True)
544+
self.reset_base()
546545

547546
log.debug("The DNF cache has been cleared.")
548547

tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_module_payload_dnf5_manager.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -995,10 +995,10 @@ def test_read_system_repositories(self):
995995
with pytest.raises(RuntimeError):
996996
self.dnf_manager.read_system_repositories()
997997

998-
# FIXME: Unless we cleared the cache.
999-
# self.dnf_manager.clear_cache()
1000-
# assert not self.dnf_manager._enabled_system_repositories
1001-
# self.dnf_manager.read_system_repositories()
998+
# Unless we cleared the cache.
999+
self.dnf_manager.clear_cache()
1000+
assert not self.dnf_manager._enabled_system_repositories
1001+
self.dnf_manager.read_system_repositories()
10021002

10031003
# Or reset the base.
10041004
self.dnf_manager.reset_base()

0 commit comments

Comments
 (0)