diff --git a/marconi/storage/mongodb/claims.py b/marconi/storage/mongodb/claims.py index cb7e1c83f..d24c56d76 100644 --- a/marconi/storage/mongodb/claims.py +++ b/marconi/storage/mongodb/claims.py @@ -118,9 +118,6 @@ class ClaimController(storage.ClaimBase): """ msg_ctrl = self.driver.message_controller - if not self.driver.queue_controller.exists(queue, project): - raise exceptions.QueueDoesNotExist(queue, project) - ttl = metadata['ttl'] grace = metadata['grace'] oid = objectid.ObjectId() @@ -148,7 +145,7 @@ class ClaimController(storage.ClaimBase): ids = [msg['_id'] for msg in msgs] if len(ids) == 0: - return (str(oid), messages) + return (None, messages) now = timeutils.utcnow() diff --git a/marconi/storage/sqlite/claims.py b/marconi/storage/sqlite/claims.py index 4af19dacd..d46358fb4 100644 --- a/marconi/storage/sqlite/claims.py +++ b/marconi/storage/sqlite/claims.py @@ -78,7 +78,10 @@ class ClaimController(base.ClaimBase): project = '' with self.driver('immediate'): - qid = utils.get_qid(self.driver, queue, project) + try: + qid = utils.get_qid(self.driver, queue, project) + except exceptions.QueueDoesNotExist: + return None, iter([]) # Clean up all expired claims in this queue diff --git a/marconi/tests/transport/wsgi/test_claims.py b/marconi/tests/transport/wsgi/test_claims.py index b11c4ae90..80d56f130 100644 --- a/marconi/tests/transport/wsgi/test_claims.py +++ b/marconi/tests/transport/wsgi/test_claims.py @@ -205,7 +205,7 @@ class ClaimsBaseTest(base.TestBase): def test_nonexistent(self): self.simulate_post('/v1/queues/nonexistent/claims', self.project_id, body='{"ttl": 100, "grace": 60}') - self.assertEquals(self.srmock.status, falcon.HTTP_404) + self.assertEquals(self.srmock.status, falcon.HTTP_204) # NOTE(cpp-cabrera): regression test against bug #1203842 def test_get_nonexistent_claim_404s(self): diff --git a/marconi/transport/wsgi/claims.py b/marconi/transport/wsgi/claims.py index a65279240..4ff2b2101 100644 --- a/marconi/transport/wsgi/claims.py +++ b/marconi/transport/wsgi/claims.py @@ -76,9 +76,6 @@ class CollectionResource(object): except input_exceptions.ValidationFailed as ex: raise wsgi_exceptions.HTTPBadRequestBody(str(ex)) - except storage_exceptions.DoesNotExist: - raise falcon.HTTPNotFound() - except Exception as ex: LOG.exception(ex) description = _(u'Claim could not be created.')