[PATCH] Ignore rescue kernels (#958906)

Chris Lumens clumens at redhat.com
Thu May 23 21:00:02 UTC 2013


> diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
> index 27de538..6376076 100644
> --- a/pyanaconda/packaging/__init__.py
> +++ b/pyanaconda/packaging/__init__.py
> @@ -374,7 +374,9 @@ class Payload(object):
>              files = glob.glob(ROOT_PATH + "/boot/vmlinuz-*")
>              files.extend(glob.glob(ROOT_PATH + "/boot/efi/EFI/redhat/vmlinuz-*"))
>              # strip off everything up to and including vmlinuz- to get versions
> -            versions = [f.split("/")[-1][8:] for f in files if os.path.isfile(f)]
> +            # Ignore rescue kernels
> +            versions = [f.split("/")[-1][8:] for f in files if os.path.isfile(f) \
> +                        and f.find("-rescue-") == -1]
>              versions.sort(cmp=cmpfunc)
>              log.debug("kernel versions: %s" % versions)
>              self._kernelVersionList = versions

While this is fine, I think the "find" bit is always a little hard to
read, when you could treat f like a list instead:

   .. and "-rescue-" not in f]

- Chris


More information about the anaconda-patches mailing list