diff options
author | Michael Elkins <melkins@tislabs.com> | 2012-07-16 20:25:19 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2012-07-16 20:25:19 +0000 |
commit | 72aadbddd83233933f7f14a98134ff2f39fb7422 (patch) | |
tree | 4ec688cf33da95c52867180bc9d1248fad6caf1a /rpkid/portal-gui/scripts/rpkigui-check-expired.py | |
parent | 4bde08155e069ea0cb30f12ba93c4db3bc4d7286 (diff) |
catch socket.error and print a friendlier message when we can't talk to rpkid. fixes #268
svn path=/trunk/; revision=4603
Diffstat (limited to 'rpkid/portal-gui/scripts/rpkigui-check-expired.py')
-rw-r--r-- | rpkid/portal-gui/scripts/rpkigui-check-expired.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/rpkid/portal-gui/scripts/rpkigui-check-expired.py b/rpkid/portal-gui/scripts/rpkigui-check-expired.py index ae7bffcc..580c007c 100644 --- a/rpkid/portal-gui/scripts/rpkigui-check-expired.py +++ b/rpkid/portal-gui/scripts/rpkigui-check-expired.py @@ -27,7 +27,7 @@ from django.core.mail import send_mail import datetime import sys -from socket import getfqdn +import socket from optparse import OptionParser from cStringIO import StringIO @@ -124,7 +124,7 @@ def check_child_certs(conf, errs): # this is not exactly right, since we have no way of knowing what the # vhost for the web portal running on this machine is -host = getfqdn() +host = socket.getfqdn() usage = '%prog [ -vV ] [ handle1 handle2... ]' @@ -160,7 +160,11 @@ qs = ResourceHolderCA.objects.all() if not args else ResourceHolderCA.objects.fi # check expiration of certs for all handles managed by the web portal for h in qs: # Force cache update since several checks require fresh data - list_received_resources(sys.stdout, h) + try: + list_received_resources(sys.stdout, h) + except socket.error, e: + print >>sys.stderr, 'Error while talking to rpkid: %s' % e + sys.exit(1) errs = StringIO() |