aboutsummaryrefslogtreecommitdiff
path: root/rpki/pubd.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-08-28 18:26:54 +0000
committerRob Austein <sra@hactrn.net>2014-08-28 18:26:54 +0000
commit5b9ca78bf14b553bf26760d420057adfb632d9d8 (patch)
treeeff260ba42ceedac6943169bd02d11ff58137248 /rpki/pubd.py
parent9c688ea237336411961d74cb6eca579080fc39f6 (diff)
New stricter publication algorithm requires us to salvage hash values
from PDUs we optimize out of the publication queue. svn path=/branches/tk705/; revision=5940
Diffstat (limited to 'rpki/pubd.py')
-rw-r--r--rpki/pubd.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/rpki/pubd.py b/rpki/pubd.py
index 4814dc24..229f9511 100644
--- a/rpki/pubd.py
+++ b/rpki/pubd.py
@@ -470,10 +470,13 @@ class delta_obj(rpki.sql.sql_persistent):
def publish(self, client, der, uri, hash):
obj = object_obj.current_object_at_uri(client, self, uri)
- if obj is not None and obj.hash == hash:
- obj.delete(self)
- elif obj is not None:
- raise rpki.exceptions.ExistingObjectAtURI("Object already published at %s" % uri)
+ if obj is not None:
+ if obj.hash == hash:
+ obj.delete(self)
+ elif hash is None:
+ raise rpki.exceptions.ExistingObjectAtURI("Object already published at %s" % uri)
+ else:
+ raise rpki.exceptions.DifferentObjectAtURI("Found different object at %s (old %s, new %s)" % (uri, obj.hash, hash))
logger.debug("Publishing %s", uri)
object_obj.create(client, self, der, uri)
se = DERSubElement(self.deltas[0], rrdp_tag_publish, der = der, uri = uri)