aboutsummaryrefslogtreecommitdiff
path: root/rpkid
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-09-04 21:52:30 +0000
committerRob Austein <sra@hactrn.net>2009-09-04 21:52:30 +0000
commit3bc20935ba333b88cdf3be4de04cc92a170cc1f9 (patch)
treec37707b34fe9327f30b699d2e638d6e95d9d7602 /rpkid
parent737e007f2d557b4fa48a4236214dce03be740998 (diff)
Cleanup
svn path=/myrpki/schema.py; revision=2734
Diffstat (limited to 'rpkid')
-rwxr-xr-xrpkid/irdbd.py35
-rw-r--r--rpkid/rpki/https.py1
-rw-r--r--rpkid/rpki/rpki_engine.py6
3 files changed, 24 insertions, 18 deletions
diff --git a/rpkid/irdbd.py b/rpkid/irdbd.py
index 2c3f49e3..9113f44f 100755
--- a/rpkid/irdbd.py
+++ b/rpkid/irdbd.py
@@ -111,24 +111,35 @@ def handler(query, path, cb):
db.ping()
- q_msg = rpki.left_right.cms_msg.unwrap(query, (bpki_ta, rpkid_cert))
+ r_msg = rpki.left_right.msg.reply()
- if not isinstance(q_msg, rpki.left_right.msg) or not q_msg.is_query():
- raise rpki.exceptions.BadQuery, "Unexpected %s PDU" % repr(q_msg)
+ try:
- r_msg = rpki.left_right.msg.reply()
+ q_msg = rpki.left_right.cms_msg.unwrap(query, (bpki_ta, rpkid_cert))
+
+ if not isinstance(q_msg, rpki.left_right.msg) or not q_msg.is_query():
+ raise rpki.exceptions.BadQuery, "Unexpected %s PDU" % repr(q_msg)
- for q_pdu in q_msg:
+ for q_pdu in q_msg:
- try:
- if type(q_pdu) in handle_dispatch:
+ try:
+ if type(q_pdu) not in handle_dispatch:
+ raise rpki.exceptions.BadQuery, "Unexpected %s PDU" % repr(q_pdu)
handle_dispatch[type(q_pdu)](q_pdu, r_msg)
- else:
- raise rpki.exceptions.BadQuery, "Unexpected %s PDU" % repr(q_pdu)
- except Exception, data:
- rpki.log.traceback()
- r_msg.append(rpki.left_right.report_error_elt.from_exception(data, q_pdu.self_handle, q_pdu.tag))
+ except (rpki.async.ExitNow, SystemExit):
+ raise
+
+ except Exception, data:
+ rpki.log.traceback()
+ r_msg.append(rpki.left_right.report_error_elt.from_exception(data, q_pdu.self_handle, q_pdu.tag))
+
+ except (rpki.async.ExitNow, SystemExit):
+ raise
+
+ except Exception, data:
+ rpki.log.traceback()
+ r_msg.append(rpki.left_right.report_error_elt.from_exception(data))
cb(200, rpki.left_right.cms_msg.wrap(r_msg, irdbd_key, irdbd_cert))
diff --git a/rpkid/rpki/https.py b/rpkid/rpki/https.py
index 1b2d948e..305182e1 100644
--- a/rpkid/rpki/https.py
+++ b/rpkid/rpki/https.py
@@ -136,7 +136,6 @@ class http_message(object):
class http_request(http_message):
def __init__(self, cmd = None, path = None, version = default_http_version, body = None, callback = None, errback = None, **headers):
- #assert cmd is None or cmd == "POST" or body is None
assert cmd == "POST" or body is None
http_message.__init__(self, version = version, body = body, headers = headers)
self.cmd = cmd
diff --git a/rpkid/rpki/rpki_engine.py b/rpkid/rpki/rpki_engine.py
index c383f9a2..b32d5465 100644
--- a/rpkid/rpki/rpki_engine.py
+++ b/rpkid/rpki/rpki_engine.py
@@ -945,7 +945,7 @@ class child_cert_obj(rpki.sql.sql_persistent):
rpki.log.info("Suppressing withdrawal of %r" % self.cert)
done()
- def reissue(self, ca_detail, callback = None, errback = None, resources = None, sia = None):
+ def reissue(self, ca_detail, callback, errback, resources = None, sia = None):
"""
Reissue an existing cert, reusing the public key. If the cert we
would generate is identical to the one we already have, we just
@@ -955,10 +955,6 @@ class child_cert_obj(rpki.sql.sql_persistent):
child_cert_obj must use the return value from this method.
"""
- # Hack during conversion, remove default values and these assertions eventually
- assert callback is not None
- assert errback is not None
-
ca = ca_detail.ca()
child = self.child()