diff options
author | Rob Austein <sra@hactrn.net> | 2016-04-23 15:03:18 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2016-04-23 15:03:18 +0000 |
commit | d086bf1f554ea70dbb34cf167b103d273c8b22ca (patch) | |
tree | 96869a3dfd6d5e6d4aa7cd77a4d5da19e659a3e7 /rpki/rpkidb | |
parent | c7d9a8366304b2a79c97948890656644218e6f97 (diff) |
Generalize the formerly-BSC-specific handling of "readonly"
subelements in left-right responses, so we don't have to duplicate the
mechanism used for BSC <pkcs10_request/> subelements when handling
Parent <rpki_root_cert/> subelements.
svn path=/branches/tk705/; revision=6372
Diffstat (limited to 'rpki/rpkidb')
-rw-r--r-- | rpki/rpkidb/models.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/rpki/rpkidb/models.py b/rpki/rpkidb/models.py index d2d6c6f2..c5adbacf 100644 --- a/rpki/rpkidb/models.py +++ b/rpki/rpkidb/models.py @@ -63,6 +63,7 @@ class XMLTemplate(object): element_type = dict(bpki_cert = rpki.x509.X509, bpki_glue = rpki.x509.X509, + rpki_root_cert = rpki.x509.X509, pkcs10_request = rpki.x509.PKCS10, signing_cert = rpki.x509.X509, signing_cert_crl = rpki.x509.CRL) @@ -112,11 +113,6 @@ class XMLTemplate(object): """ Add an acknowledgement PDU in response to a create, set, or destroy action. - - This includes a bit of special-case code for BSC objects which has - to go somewhere; we could handle it via some kind method of - call-out to the BSC model, but it's not worth building a general - mechanism for one case, so we do it inline and have done. """ assert q_pdu.tag == rpki.left_right.xmlns + self.name @@ -127,9 +123,11 @@ class XMLTemplate(object): r_pdu.set(self.name + "_handle", getattr(obj, self.name + "_handle")) if q_pdu.get("tag"): r_pdu.set("tag", q_pdu.get("tag")) - if self.name == "bsc" and action != "destroy" and obj.pkcs10_request is not None: - assert not obj.pkcs10_request.empty() - SubElement(r_pdu, rpki.left_right.xmlns + "pkcs10_request").text = obj.pkcs10_request.get_Base64() + if action != "destroy": + for k in self.readonly: + v = getattr(obj, k) + if v is not None and not v.empty(): + SubElement(r_pdu, rpki.left_right.xmlns + k).text = v.get_Base64() if self.debug: logger.debug("XMLTemplate.acknowledge(): %s", ElementToString(r_pdu)) |