summaryrefslogtreecommitdiffstats
path: root/yuminstall.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2008-11-21 15:19:01 -0500
committerChris Lumens <clumens@redhat.com>2008-11-21 15:19:01 -0500
commit1c091082de485332bbf50025a995bb7196647691 (patch)
tree7ea8385196406d19cde38a1a01495129fa13f03e /yuminstall.py
parent0e4b74bb811a9739e5146833264c5140ec0309f2 (diff)
downloadanaconda-1c091082de485332bbf50025a995bb7196647691.tar.gz
anaconda-1c091082de485332bbf50025a995bb7196647691.tar.xz
anaconda-1c091082de485332bbf50025a995bb7196647691.zip
returnNewestByName now raises an error instead of returning [] (#472462).
Actually, it's been doing this for several months now and we are even doing the correct thing in a couple places. We just didn't go back and change our calls elsewhere in yuminstall.py to match.
Diffstat (limited to 'yuminstall.py')
-rw-r--r--yuminstall.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/yuminstall.py b/yuminstall.py
index 1ec546328..05ea1694a 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -1209,9 +1209,11 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
def getBestKernelByArch(pkgname, ayum):
"""Convenience func to find the best arch of a kernel by name"""
- pkgs = ayum.pkgSack.returnNewestByName(pkgname)
- if len(pkgs) == 0:
+ try:
+ pkgs = ayum.pkgSack.returnNewestByName(pkgname)
+ except yum.Errors.PackageSackError:
return None
+
pkgs = self.ayum.bestPackagesFromList(pkgs)
if len(pkgs) == 0:
return None
@@ -1556,10 +1558,12 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
def _checkUpgradeArch(self, anaconda):
# get the arch of the initscripts package
- pkgs = self.ayum.pkgSack.returnNewestByName('initscripts')
- if len(pkgs) == 0:
+ try:
+ pkgs = self.ayum.pkgSack.returnNewestByName('initscripts')
+ except yum.Errors.PackageSackError:
log.info("no packages named initscripts")
- return
+ return None
+
pkgs = self.ayum.bestPackagesFromList(pkgs)
if len(pkgs) == 0:
log.info("no best package")