[Yum-devel] [PATCH 1/2] _retrieveMD: no exception when retrieve_can_fail. BZ 858510
Zdeněk Pavlas
zpavlas at redhat.com
Fri Sep 21 14:33:33 UTC 2012
- If retrieve_can_fail==True, return None instead of exception
also when cacheonly.
- Save few lines by running cacheonly path after preload+checkMD.
Preloading is no-op when using root cache, so we should never
hit EPERM here.
---
yum/yumRepo.py | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 4648da9..c930d66 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -1707,27 +1707,21 @@ Insufficient space in download directory %s
# got it, move along
return local
- if self.cache == 1:
- if os.path.exists(local):
- try:
- self.checkMD(local, mdtype)
- except URLGrabError, e:
- raise Errors.RepoError, \
- "Caching enabled and local cache: %s does not match checksum" % local
- else:
- return local
-
- else: # ain't there - raise
- raise Errors.RepoError, \
- "Caching enabled but no local cache of %s from %s" % (local,
- self.ui_id)
-
if (os.path.exists(local) or
self._preload_md_from_system_cache(os.path.basename(local))):
if self._checkMD(local, mdtype, check_can_fail=True):
self.retrieved[mdtype] = 1
return local # it's the same return the local one
+ if self.cache == 1:
+ if retrieve_can_fail:
+ return None
+ if os.path.exists(local):
+ msg = "Caching enabled and local cache: %s does not match checksum" % local
+ else:
+ msg = "Caching enabled but no local cache of %s from %s" % (local, self.ui_id)
+ raise Errors.RepoError, msg
+
try:
def checkfunc(obj):
self.checkMD(obj, mdtype)
--
1.7.4.4
More information about the Yum-devel
mailing list