aboutsummaryrefslogtreecommitdiff
path: root/rpkid/irdbd.py
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/irdbd.py
parent737e007f2d557b4fa48a4236214dce03be740998 (diff)
Cleanup
svn path=/myrpki/schema.py; revision=2734
Diffstat (limited to 'rpkid/irdbd.py')
-rwxr-xr-xrpkid/irdbd.py35
1 files changed, 23 insertions, 12 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))