[yum-cvs] yum-utils/plugins/security security.py,1.3,1.4

Tim Lauridsen timlau at linux.duke.edu
Wed May 16 07:41:24 UTC 2007


Update of /home/groups/yum/cvs/yum-utils/plugins/security
In directory login1.linux.duke.edu:/tmp/cvs-serv328/plugins/security

Modified Files:
	security.py 
Log Message:
Added patch by James Antill:

 It seems that on RHEL5 there are update metadata entries with
references == None (in my FC6 testing they were always == []). This
gives a traceback with the current code. 

Index: security.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-utils/plugins/security/security.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- security.py	8 May 2007 07:54:18 -0000	1.3
+++ security.py	16 May 2007 07:41:22 -0000	1.4
@@ -60,12 +60,19 @@
             continue # No metadata found for this repo
     return md_info
 
+def ysp__safe_refs(refs):
+    """ Sometimes refs == None, if so return the empty list here. 
+        So we don't have to check everywhere. """
+    if refs == None:
+        return []
+    return refs
+
 def ysp_should_filter_pkg(opts, pkg, md, used_map):
     """ Do the package filtering for should_show and should_keep. """
     
     def has_id(refs, ref_type, ref_ids):
         ''' Check if the given ID is a match. '''
-        for ref in refs:
+        for ref in ysp__safe_refs(refs):
             if ref['type'] != ref_type:
                 continue
             if ref['id'] not in ref_ids:
@@ -92,7 +99,7 @@
     if rname == "security":
         if md['type'] == 'security':
             return md
-    for ref in md['references']:
+    for ref in ysp__safe_refs(md['references']):
         if ref['type'] != rname:
             continue
         return md
@@ -146,7 +153,7 @@
         # Make the list view much smaller
         # ysp_show_pkg_md_info(pkg, md, msg)
         if disp and ysp_has_info_md(disp, md):
-            for ref in md['references']:
+            for ref in ysp__safe_refs(md['references']):
                 if ref['type'] != disp:
                     continue
                 msg(" %s %-8s %s" % (str(ref['id']), md['type'], pkg))
@@ -374,7 +381,6 @@
         conduit.info(2, 'Needed %d packages, for security' % (cnt))
     else:
         conduit.info(2, 'No packages needed, for security')
-        sys.exit(0)
 
 if __name__ == '__main__':
     print "This is a plugin that is supposed to run from inside YUM"




More information about the Yum-cvs-commits mailing list