[Yum-devel] [PATCH] cacheonly: skip repo when group metadata not available. BZ 864717
Zdenek Pavlas
zpavlas at redhat.com
Thu Oct 11 09:42:37 UTC 2012
> > Make sure that _retrieveMD() returns None
> > instead of raising RepoError when cacheonly=True
> We can/should do both though, no?
Yes, _retriveveMD() raising errors with skip_if_unavailable=True should
probably count as a bug. When fixed, we have to handle such error explicitly..
So this is probably better:
commit 5acb4dbe11615c3969f4843d7ee9fbaa0393c08c
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date: Wed Oct 10 14:44:37 2012 +0200
cacheonly: skip repo when group metadata not available. BZ 864717
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 5ab7ff7..e362c43 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -1712,12 +1712,16 @@ YumRepo._retrieveMD()
try:
self.checkMD(local, mdtype)
except URLGrabError, e:
+ if retrieve_can_fail:
+ return None
raise Errors.RepoError, \
"Caching enabled and local cache: %s does not match checksum" % local
else:
return local
else: # ain't there - raise
+ if retrieve_can_fail:
+ return None
raise Errors.RepoError, \
"Caching enabled but no local cache of %s from %s" % (local,
self.ui_id)
diff --git a/yum/__init__.py b/yum/__init__.py
index a1b045f..de015d2 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -931,6 +931,10 @@ YumBase.getGroups()
self.verbose_logger.log(logginglevels.DEBUG_4,
_('Adding group file from repository: %s'), repo)
groupfile = repo.getGroups()
+ if not groupfile:
+ msg = _('Failed to retrieve groups file for repository: %s') % repo
+ self.logger.critical(msg)
+ continue
try:
self._comps.add(groupfile)
except (Errors.GroupsError,Errors.CompsException), e:
More information about the Yum-devel
mailing list