Skip to content

Commit b2d9c31

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 d78b7ce commit b2d9c31

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
@@ -778,8 +778,7 @@ def clear_cache(self):
778778
shutil.rmtree(DNF_CACHE_DIR, ignore_errors=True)
779779
shutil.rmtree(DNF_PLUGINCONF_DIR, ignore_errors=True)
780780

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

784783
log.debug("The DNF cache has been cleared.")
785784

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -1001,10 +1001,10 @@ def test_read_system_repositories(self):
10011001
with pytest.raises(RuntimeError):
10021002
self.dnf_manager.read_system_repositories()
10031003

1004-
# FIXME: Unless we cleared the cache.
1005-
# self.dnf_manager.clear_cache()
1006-
# assert not self.dnf_manager._enabled_system_repositories
1007-
# self.dnf_manager.read_system_repositories()
1004+
# Unless we cleared the cache.
1005+
self.dnf_manager.clear_cache()
1006+
assert not self.dnf_manager._enabled_system_repositories
1007+
self.dnf_manager.read_system_repositories()
10081008

10091009
# Or reset the base.
10101010
self.dnf_manager.reset_base()

0 commit comments

Comments
 (0)