diff options
-rw-r--r-- | rpkid/rpki/exceptions.py | 5 | ||||
-rw-r--r-- | rpkid/rpki/left_right.py | 3 | ||||
-rw-r--r-- | rpkid/rpki/up_down.py | 15 |
3 files changed, 20 insertions, 3 deletions
diff --git a/rpkid/rpki/exceptions.py b/rpkid/rpki/exceptions.py index 3f350f04..4434ac45 100644 --- a/rpkid/rpki/exceptions.py +++ b/rpkid/rpki/exceptions.py @@ -273,3 +273,8 @@ class NoCoveringCertForROA(RPKI_Exception): """ Couldn't find a covering certificate to generate ROA. """ + +class BSCNotReady(RPKI_Exception): + """ + BSC not yet in a usable state, signing_cert not set. + """ diff --git a/rpkid/rpki/left_right.py b/rpkid/rpki/left_right.py index 5f31d4ba..07a1db54 100644 --- a/rpkid/rpki/left_right.py +++ b/rpkid/rpki/left_right.py @@ -671,6 +671,9 @@ class parent_elt(data_elt): if bsc is None: raise rpki.exceptions.BSCNotFound, "Could not find BSC %s" % self.bsc_id + if bsc.signing_cert is None: + raise rpki.exceptions.BSCNotReady, "BSC %s is not yet usable" % self.bsc_id + q_msg = rpki.up_down.message_pdu.make_query( payload = q_pdu, sender = self.sender_name, diff --git a/rpkid/rpki/up_down.py b/rpkid/rpki/up_down.py index b45390e0..2e088fb3 100644 --- a/rpkid/rpki/up_down.py +++ b/rpkid/rpki/up_down.py @@ -271,8 +271,15 @@ class list_pdu(base_elt): @classmethod def query(cls, parent, cb, eb): - """Send a "list" query to parent.""" - parent.query_up_down(cls(), cb, eb) + """ + Send a "list" query to parent. + """ + try: + parent.query_up_down(cls(), cb, eb) + except (rpki.async.ExitNow, SystemExit): + raise + except Exception, e: + eb(e) class class_response_syntax(base_elt): """ @@ -280,7 +287,9 @@ class class_response_syntax(base_elt): """ def __init__(self): - """Initialize class_response_syntax.""" + """ + Initialize class_response_syntax. + """ base_elt.__init__(self) self.classes = [] |