summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/submitcert.py30
1 files changed, 22 insertions, 8 deletions
diff --git a/tools/submitcert.py b/tools/submitcert.py
index 80a3e37..2bb0c1a 100755
--- a/tools/submitcert.py
+++ b/tools/submitcert.py
@@ -13,6 +13,7 @@ import hashlib
import itertools
from certtools import *
import os
+import signal
from multiprocessing import Pool
@@ -32,7 +33,10 @@ def submitcert(certfile):
certs = get_certs_from_file(certfile)
timing_point(timing, "readcerts")
- result = add_chain(baseurl, {"chain":map(base64.b64encode, certs)})
+ try:
+ result = add_chain(baseurl, {"chain":map(base64.b64encode, certs)})
+ except SystemExit:
+ return None
timing_point(timing, "addchain")
@@ -42,10 +46,13 @@ def submitcert(certfile):
timing_point(timing, "checksig")
except AssertionError, e:
print "ERROR:", e
- sys.exit(1)
+ return None
+ except urllib2.HTTPError, e:
+ print "ERROR:", e
+ return None
except ecdsa.keys.BadSignatureError, e:
print "ERROR: bad signature"
- sys.exit(1)
+ return None
if lookup_in_log:
@@ -91,8 +98,15 @@ def submitcert(certfile):
timing_point(timing, "lookup")
return timing["deltatimes"]
-p = Pool(1)
-
-for timing in p.imap_unordered(submitcert, certfiles):
- print timing
-
+p = Pool(1, lambda: signal.signal(signal.SIGINT, signal.SIG_IGN))
+
+try:
+ for timing in p.imap_unordered(submitcert, certfiles):
+ if timing == None:
+ p.terminate()
+ p.join()
+ sys.exit(1)
+ print timing
+except KeyboardInterrupt:
+ p.terminate()
+ p.join()