[yum-commits] plugins/security

James Antill james at osuosl.org
Wed Jun 22 15:50:57 UTC 2011


 plugins/security/security.py |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 20b1372bc678c2d26ad04f758bbe3c7b91aeea29
Author: James Antill <james at and.org>
Date:   Wed Jun 22 11:50:48 2011 -0400

    Try to be clever when sorting the security severities.

diff --git a/plugins/security/security.py b/plugins/security/security.py
index 66e61e2..868ff2b 100755
--- a/plugins/security/security.py
+++ b/plugins/security/security.py
@@ -318,7 +318,16 @@ class UpdateinfoCommand:
                     n = sn + " " + n
             print "    %*u %s notice(s)" % (maxsize, counts[T], n)
             if T == 'security' and len(sev_counts) != 1:
-                for sn in sorted(sev_counts):
+                def _sev_sort_key(key):
+                    # We want these in order, from "highest" to "lowest".
+                    # Anything unknown is "higher". meh.
+                    return {'Critical' : "zz1",
+                            'Important': "zz2",
+                            'Moderate' : "zz3",
+                            'Low'      : "zz4",
+                            }.get(key, key)
+
+                for sn in sorted(sev_counts, key=_sev_sort_key):
                     args = (maxsize, sev_counts[sn],sn or '?', outT['security'])
                     print "        %*u %s %s notice(s)" % args
         _check_running_kernel(base, md_info, _msg)


More information about the Yum-commits mailing list