diff options
author | Chris Lumens <clumens@redhat.com> | 2008-11-21 15:19:01 -0500 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2008-11-21 15:19:01 -0500 |
commit | 1c091082de485332bbf50025a995bb7196647691 (patch) | |
tree | 7ea8385196406d19cde38a1a01495129fa13f03e /yuminstall.py | |
parent | 0e4b74bb811a9739e5146833264c5140ec0309f2 (diff) | |
download | anaconda-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.py | 14 |
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") |