From bbcd593a74c9c77223f3a5d4eaf1ef1eab0364a4 Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Wed, 26 Feb 2014 11:18:39 +0100 Subject: [PATCH] Don't raise `DoesNotExist` on claims deletion We don't raise DoesNotExist when the queue that a claim has to be deleted from does not exist. Implements blueprint: sql-storage-driver Change-Id: I2a3e11d493b066c5dae7af81db81989468e90726 --- marconi/queues/storage/sqlalchemy/claims.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/marconi/queues/storage/sqlalchemy/claims.py b/marconi/queues/storage/sqlalchemy/claims.py index 46a30d4f2..cd1d02bc1 100644 --- a/marconi/queues/storage/sqlalchemy/claims.py +++ b/marconi/queues/storage/sqlalchemy/claims.py @@ -165,7 +165,13 @@ class ClaimController(storage.Claim): return with self.driver.trans() as trans: - qid = utils.get_qid(self.driver, queue, project) + try: + # NOTE(flaper87): This could probably use some + # joins and be just 1 query. + qid = utils.get_qid(self.driver, queue, project) + except errors.QueueDoesNotExist: + return + and_stmt = sa.and_(tables.Claims.c.id == cid, tables.Claims.c.qid == qid) dlt = tables.Claims.delete().where(and_stmt)