Blame SOURCES/0013-Fix-Python-dnf-API-does-not-respect-cacheonly-RhBug-.patch

29510e
From db52d259645daf8ca0ae06e829787d36171f2d5b Mon Sep 17 00:00:00 2001
29510e
From: Jaroslav Rohel <jrohel@redhat.com>
29510e
Date: Wed, 20 Oct 2021 09:20:03 +0200
bc72d2
Subject: [PATCH] Fix: Python dnf API does not respect cacheonly
bc72d2
 (RhBug:1862970)
29510e
29510e
`Repo` object has always been constructed with default synchronization
29510e
strategy. The configuration option `cacheonly` was ignored. DNF
29510e
application set synchronization strategy later in the `Cli` object
29510e
during processing demands.
29510e
29510e
The fix takes into account the `cacheonly` option during the construction
29510e
of the `Repo` object. Synchronization strategy may still be overriden
29510e
during demand processing.
29510e
---
29510e
 dnf/repo.py | 2 +-
29510e
 1 file changed, 1 insertion(+), 1 deletion(-)
29510e
29510e
diff --git a/dnf/repo.py b/dnf/repo.py
bc72d2
index bb422309..1822cf01 100644
29510e
--- a/dnf/repo.py
29510e
+++ b/dnf/repo.py
29510e
@@ -434,7 +434,7 @@ class Repo(dnf.conf.RepoConf):
29510e
         self._pkgdir = None
29510e
         self._key_import = _NullKeyImport()
29510e
         self.metadata = None  # :api
29510e
-        self._repo.setSyncStrategy(self.DEFAULT_SYNC)
29510e
+        self._repo.setSyncStrategy(SYNC_ONLY_CACHE if parent_conf and parent_conf.cacheonly else self.DEFAULT_SYNC)
29510e
         if parent_conf:
29510e
             self._repo.setSubstitutions(parent_conf.substitutions)
29510e
         self._substitutions = dnf.conf.substitutions.Substitutions()
bc72d2
-- 
bc72d2
2.35.1
29510e