[PATCH] _readRawRepoFile: return only valid (ini, section_id). BZ 1018795

Zdenek Pavlas zpavlas at redhat.com
Mon Nov 4 15:55:41 UTC 2013


Apparently we may loop over all sections without a match and
return section_id that's not defined.  Return None instead.
---
 yum/config.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/yum/config.py b/yum/config.py
index 17aa0ca..df24900 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -1224,6 +1224,9 @@ def _readRawRepoFile(repo):
         for sect in ini._sections.keys():
             if varReplace(sect, repo.yumvar) == repo.id:
                 section_id = sect
+                break
+        else:
+            return None
     return ini, section_id
 
 def writeRawRepoFile(repo,only=None):
-- 
1.7.11.7



More information about the Yum-devel mailing list