aboutsummaryrefslogtreecommitdiff
path: root/rpki/pubd.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpki/pubd.py')
-rw-r--r--rpki/pubd.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/rpki/pubd.py b/rpki/pubd.py
index 1849a0dd..21fd9298 100644
--- a/rpki/pubd.py
+++ b/rpki/pubd.py
@@ -428,9 +428,10 @@ class delta_obj(rpki.sql.sql_persistent):
self.sql_mark_dirty()
def publish(self, client, der, uri, hash):
- if hash is not None:
- self.withdraw(client, uri, hash)
- elif object_obj.current_object_at_uri(client, self, uri) is not None:
+ 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)
logger.debug("Publishing %s", uri)
object_obj.create(client, self, der, uri)