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

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



---
 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
-- 
1.7.0.1


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