diff options
author | Rob Austein <sra@hactrn.net> | 2009-10-27 00:32:59 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-10-27 00:32:59 +0000 |
commit | 18ce2b3f6d8f8f53b7d7d6dc13ec7aef702cc0c8 (patch) | |
tree | dea49de0d4f81e5ed10f96b3a0772cda27662d18 | |
parent | 1e11a8aa6905c02a4695313d5d6a6bd3ba3732dc (diff) |
Checkpoint
svn path=/rpkid/rpki/left_right.py; revision=2837
-rw-r--r-- | rpkid/rpki/left_right.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/rpkid/rpki/left_right.py b/rpkid/rpki/left_right.py index d8a8f633..6888dc34 100644 --- a/rpkid/rpki/left_right.py +++ b/rpkid/rpki/left_right.py @@ -607,9 +607,14 @@ class repository_elt(data_elt): """Fetch all parent objects that link to this repository object.""" return parent_elt.sql_fetch_where(self.gctx, "repository_id = %s", (self.repository_id,)) - def call_pubd(self, callback, errback, q_msg): + def call_pubd(self, callback, errback, q_msg, handlers = None): """ Send a message to publication daemon and return the response. + + If handlers is not None, it's a dict of handler functions to + process the response PDUs. If the tag value in the response PDU + appears in the dict, the associated handler is called to process + the PDU. If no tag matches, no handler is called. """ rpki.log.trace() bsc = self.bsc() @@ -619,6 +624,10 @@ class repository_elt(data_elt): def done(r_cms): try: r_msg = rpki.publication.cms_msg.unwrap(r_cms, bpki_ta_path) + if handlers is not None: + for r_pdu in r_msg: + if r_pdu.tag in handlers: + handlers[r_pdu.tag](r_pdu) for r_pdu in r_msg: if isinstance(r_pdu, rpki.publication.report_error_elt): t = rpki.exceptions.__dict__.get(r_pdu.error_code) |