Merge "Use mongodb delete_one method instead of deprecated remove method"
This commit is contained in:
commit
eed85588a4
@ -82,8 +82,8 @@ class CatalogueController(base.CatalogueBase):
|
|||||||
|
|
||||||
@utils.raises_conn_error
|
@utils.raises_conn_error
|
||||||
def delete(self, project, queue):
|
def delete(self, project, queue):
|
||||||
self._col.remove({PRIMARY_KEY: utils.scope_queue_name(queue, project)},
|
self._col.delete_one({
|
||||||
w=0)
|
PRIMARY_KEY: utils.scope_queue_name(queue, project)})
|
||||||
|
|
||||||
def update(self, project, queue, pool=None):
|
def update(self, project, queue, pool=None):
|
||||||
# NOTE(cpp-cabrera): _insert handles conn_error
|
# NOTE(cpp-cabrera): _insert handles conn_error
|
||||||
|
@ -135,7 +135,7 @@ class FlavorsController(base.FlavorsBase):
|
|||||||
|
|
||||||
@utils.raises_conn_error
|
@utils.raises_conn_error
|
||||||
def delete(self, name, project=None):
|
def delete(self, name, project=None):
|
||||||
self._col.remove({'n': name, 'p': project}, w=0)
|
self._col.delete_one({'n': name, 'p': project})
|
||||||
|
|
||||||
@utils.raises_conn_error
|
@utils.raises_conn_error
|
||||||
def drop_all(self):
|
def drop_all(self):
|
||||||
|
@ -226,7 +226,7 @@ class MessageController(storage.Message):
|
|||||||
"""
|
"""
|
||||||
scope = utils.scope_queue_name(queue_name, project)
|
scope = utils.scope_queue_name(queue_name, project)
|
||||||
collection = self._collection(queue_name, project)
|
collection = self._collection(queue_name, project)
|
||||||
collection.remove({PROJ_QUEUE: scope}, w=0)
|
collection.delete_many({PROJ_QUEUE: scope})
|
||||||
|
|
||||||
def _list(self, queue_name, project=None, marker=None,
|
def _list(self, queue_name, project=None, marker=None,
|
||||||
echo=False, client_uuid=None, projection=None,
|
echo=False, client_uuid=None, projection=None,
|
||||||
@ -698,7 +698,7 @@ class MessageController(storage.Message):
|
|||||||
|
|
||||||
raise errors.MessageNotClaimed(message_id)
|
raise errors.MessageNotClaimed(message_id)
|
||||||
|
|
||||||
collection.remove(query['_id'], w=0)
|
collection.delete_one(query)
|
||||||
|
|
||||||
@utils.raises_conn_error
|
@utils.raises_conn_error
|
||||||
@utils.retries_on_autoreconnect
|
@utils.retries_on_autoreconnect
|
||||||
@ -710,7 +710,7 @@ class MessageController(storage.Message):
|
|||||||
}
|
}
|
||||||
|
|
||||||
collection = self._collection(queue_name, project)
|
collection = self._collection(queue_name, project)
|
||||||
collection.remove(query, w=0)
|
collection.delete_many(query)
|
||||||
|
|
||||||
@utils.raises_conn_error
|
@utils.raises_conn_error
|
||||||
@utils.retries_on_autoreconnect
|
@utils.retries_on_autoreconnect
|
||||||
|
@ -146,7 +146,7 @@ class PoolsController(base.PoolsBase):
|
|||||||
flavors = ', '.join([x['name'] for x in res])
|
flavors = ', '.join([x['name'] for x in res])
|
||||||
raise errors.PoolInUseByFlavor(name, flavors)
|
raise errors.PoolInUseByFlavor(name, flavors)
|
||||||
|
|
||||||
self._col.remove({'n': name}, w=0)
|
self._col.delete_one({'n': name})
|
||||||
except errors.PoolDoesNotExist:
|
except errors.PoolDoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ class QueueController(storage.Queue):
|
|||||||
@utils.retries_on_autoreconnect
|
@utils.retries_on_autoreconnect
|
||||||
@_exists.purges
|
@_exists.purges
|
||||||
def _delete(self, name, project=None):
|
def _delete(self, name, project=None):
|
||||||
self._collection.remove(_get_scoped_query(name, project))
|
self._collection.delete_one(_get_scoped_query(name, project))
|
||||||
|
|
||||||
@utils.raises_conn_error
|
@utils.raises_conn_error
|
||||||
@utils.retries_on_autoreconnect
|
@utils.retries_on_autoreconnect
|
||||||
|
@ -155,9 +155,9 @@ class SubscriptionController(base.Subscription):
|
|||||||
|
|
||||||
@utils.raises_conn_error
|
@utils.raises_conn_error
|
||||||
def delete(self, queue, subscription_id, project=None):
|
def delete(self, queue, subscription_id, project=None):
|
||||||
self._collection.remove({'_id': utils.to_oid(subscription_id),
|
self._collection.delete_one({'_id': utils.to_oid(subscription_id),
|
||||||
'p': project,
|
'p': project,
|
||||||
's': queue}, w=0)
|
's': queue})
|
||||||
|
|
||||||
@utils.raises_conn_error
|
@utils.raises_conn_error
|
||||||
def get_with_subscriber(self, queue, subscriber, project=None):
|
def get_with_subscriber(self, queue, subscriber, project=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user