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
This commit is contained in:
Flavio Percoco 2014-02-26 11:18:39 +01:00
parent 254ab064e8
commit bbcd593a74

View File

@ -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)