aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Elkins <melkins@tislabs.com>2012-07-05 23:32:49 +0000
committerMichael Elkins <melkins@tislabs.com>2012-07-05 23:32:49 +0000
commit64eb19d701ba2f00255a72a69633a94f4522cb2d (patch)
treef27b4ff905d521309523dd52996272428766f89c
parent419651f5130963cbcfe2a5a4b3aacc9c66fac934 (diff)
use str() to print to detail of each Certificate subclass when displaying a warning message
svn path=/trunk/; revision=4581
-rw-r--r--rpkid/portal-gui/scripts/rpkigui-check-expired.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/rpkid/portal-gui/scripts/rpkigui-check-expired.py b/rpkid/portal-gui/scripts/rpkigui-check-expired.py
index b077d47a..09996ef1 100644
--- a/rpkid/portal-gui/scripts/rpkigui-check-expired.py
+++ b/rpkid/portal-gui/scripts/rpkigui-check-expired.py
@@ -34,7 +34,7 @@ expire_time = now + datetime.timedelta(expire_days)
Verbose = False
-def check_cert(conf, p, object_name=None):
+def check_cert(p):
"""Check the expiration date on the X.509 certificates in each element of
the list.
@@ -45,14 +45,14 @@ def check_cert(conf, p, object_name=None):
t = p.certificate.getNotAfter()
if Verbose or t <= expire_time:
e = 'expired' if t <= now else 'will expire'
- n = p.__class__.__name__ if object_name is None else object_name
- print "%s's %s %s on %s" % (conf.handle, n, e, t)
+ print "%(type)s %(desc)s %(expire)s on %(date)s" % {
+ 'type': p.__class__.__name__, 'desc': str(p), 'expire': e,
+ 'date': t}
-
-def check_cert_list(conf, x, object_name=None):
+def check_cert_list(x):
for p in x:
- check_cert(conf, p, object_name)
+ check_cert(p)
def check_expire(handle):
@@ -97,17 +97,17 @@ Verbose = options.verbose
# check expiration of certs for all handles managed by the web portal
for h in ResourceHolderCA.objects.all():
- check_cert(h, h)
+ check_cert(h)
# HostedCA is the ResourceHolderCA cross certified under ServerCA, so check
# the ServerCA expiration date as well
- check_cert(h, h.hosted_by)
- check_cert(h, h.hosted_by.issuer)
+ check_cert(h.hosted_by)
+ check_cert(h.hosted_by.issuer)
- check_cert_list(h, h.bscs.all())
- check_cert_list(h, h.parents.all())
- check_cert_list(h, h.children.all())
- check_cert_list(h, h.repositories.all())
+ check_cert_list(h.bscs.all())
+ check_cert_list(h.parents.all())
+ check_cert_list(h.children.all())
+ check_cert_list(h.repositories.all())
check_expire(h)