commit:     f12dcd69d558b3b5f58ecd21ee20e347a06a3405
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 17 19:50:53 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Mar 17 19:50:53 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=f12dcd69

gkeys/checks.py: Fix the expiry warning summary not detecting any

Add logger messages for expiry errors/warnings

 gkeys/gkeys/actions.py | 2 +-
 gkeys/gkeys/checks.py  | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py
index b2b8cf3..cfe69ee 100644
--- a/gkeys/gkeys/actions.py
+++ b/gkeys/gkeys/actions.py
@@ -459,7 +459,7 @@ class Actions(object):
                             if not key.bits:
                                 failed['bits'].append(_unicode("%s <%s>: %s")
                                     % (gkey.name, gkey.nick, key.fingerprint))
-                        if "Warning" in key.expire_reason:
+                        if "warning" in key.expire_reason.lower():
                             failed['warn'].append(_unicode("%s <%s>: %s ")
                                 % (gkey.name, gkey.nick, key.fingerprint))
                     if True in pub_pass['signs']:

diff --git a/gkeys/gkeys/checks.py b/gkeys/gkeys/checks.py
index bddad5f..a3af3ab 100644
--- a/gkeys/gkeys/checks.py
+++ b/gkeys/gkeys/checks.py
@@ -369,12 +369,15 @@ class KeyChecks(object):
             stats[SPEC_INDEX['expire']] = True
         elif days > delta_t and not ('i' in data.validity or 'r' in 
data.validity):
             stats[SPEC_INDEX['expire_reason']] = '<== Exceeds specification'
+            self.logger.error("ERROR in key %s : gpg key expire date: %s 
EXCEEDS specification"
+                % (data.long_keyid, data.expiredate))
         else:
-            self.logger.debug("ERROR in key %s : invalid gpg key expire date: 
%s"
+            self.logger.error("ERROR in key %s : invalid gpg key expire date: 
%s"
                 % (data.long_keyid, data.expiredate))
         if 0 < days < 30 and not ('i' in data.validity or 'r' in 
data.validity):
             stats[SPEC_INDEX['expire_reason']] = '<== WARNING < 30 days'
-
+            self.logger.warn("WARNING in key %s : gpg key expire date: %s 
WARNING < 30 days"
+                % (data.long_keyid, data.expiredate))
         return stats
 
 
@@ -395,7 +398,7 @@ class KeyChecks(object):
                     stats[SPEC_INDEX['encrypt_capable']] = True
                 elif cap not in CAPABILITY_MAP:
                     stats[SPEC_INDEX['caps']] = False
-                    self.logger.debug("ERROR in key %s : unknown gpg key 
capability: %s"
+                    self.logger.error("ERROR in key %s : unknown gpg key 
capability: %s"
                         % (data.long_keyid, cap))
         stats[SPEC_INDEX['long_caps']] = ', '.join(kcaps)
         return stats

Reply via email to