Fix handle_delete for zaqar queue
Now the call to client.queue() is wrapped in try-except clause, but actually queue() doesn't make any calls to api and can't rise any exception. Such behaviour can lead to UPDDATE_FAILED state of the stack if the queue will not exist. Try to delete queue and then catch appropriate exception. Change-Id: I484bae099e3236d6b00ec5b3c2c562d971b7463e
This commit is contained in:
parent
8ebf25546c
commit
1369989db7
|
@ -106,11 +106,9 @@ class ZaqarQueue(resource.Resource):
|
|||
if not self.resource_id:
|
||||
return
|
||||
try:
|
||||
queue = self.client().queue(self.resource_id, auto_create=False)
|
||||
self.client().queue(self.resource_id, auto_create=False).delete()
|
||||
except Exception as exc:
|
||||
self.client_plugin().ignore_not_found(exc)
|
||||
else:
|
||||
queue.delete()
|
||||
|
||||
def href(self):
|
||||
api_endpoint = self.client().api_url
|
||||
|
|
|
@ -200,7 +200,9 @@ class ZaqarMessageQueueTest(common.HeatTestCase):
|
|||
mock_stack = mock.Mock()
|
||||
mock_stack.db_resource_get.return_value = None
|
||||
|
||||
mockclient.return_value.queue.side_effect = ResourceNotFound
|
||||
zaqar_q = mock.Mock()
|
||||
zaqar_q.delete.side_effect = ResourceNotFound
|
||||
mockclient.return_value.queue.return_value = zaqar_q
|
||||
mockplugin.return_value.ignore_not_found.return_value = None
|
||||
zplugin = queue.ZaqarQueue("test_delete_not_found", mock_def,
|
||||
mock_stack)
|
||||
|
|
Loading…
Reference in New Issue