[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH] Be more resilient to config files missing sections and options (#590591).



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/10/2010 08:23 AM, Chris Lumens wrote:
> ---
>  yuminstall.py |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/yuminstall.py b/yuminstall.py
> index 3d8c318..1d54f24 100644
> --- a/yuminstall.py
> +++ b/yuminstall.py
> @@ -607,16 +607,17 @@ class AnacondaYum(YumSorter):
>          variant = c.get("general", "variant")
>  
>          section = "variant-%s" % variant
> -        if c.has_section(section):
> +        if c.has_section(section) and c.has_option(section, "addons"):
>              validAddons = c.get(section, "addons").split(",")
>          else:
>              return retval
>  
>          for addon in validAddons:
> -            if not c.has_section("addon-%s" % addon):
> +            addonSection = "addon-%s" % addon
> +            if not c.has_section(addonSection) or not c.has_option(addonSection, "repository"):
>                  continue
>  
> -            url = "%s/%s" % (baseurl, c.get("addon-%s" % addon, "repository"))
> +            url = "%s/%s" % (baseurl, c.get(addonSection, "repository"))
>              retval.append((addon, url))
>  
>          return retval

ACK

- -- 
Brian C. Lane <bcl redhat com>
Red Hat / Port Orchard, WA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEVAwUBS+gs5xF+jBaO/jp/AQIohQgAhi8/cvhfdGrRB25d0dHnFXIuCYLVTh/N
tnIZKyuYU4+JrOSlekXNVcWLA7VrjkOWP3oEMN9fJpS+50FH0/TwlBERm3tI6nSQ
8cwa/BvopTy+dltUeYw+3maGFUJvd6jM0h8fJl3bRHAMTvKC8z5GDKH2GFsZtO+R
LIQYVZCcqjdBauSO+WpeBkw+Dd/KNYDLWuFYr9MW1SsIdR7L9VyahvaIhemQVSod
Z1M2ifRZ+KQEnO+/LeLLEYhGq4hh1hqDGFqgokRz75LH/yEK59nwMbbGyuytnKD9
KAwHwMIkatqNoDYX/facOqE7XjlbJU2zUWFlJg9ZugKshcQH8zFXKg==
=dC74
-----END PGP SIGNATURE-----


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]