"is_resource_deleted" fails to verify delete
Is resource deleted in images_client.py isn't adequate for admin role because when checking for deleted images the admin role returns a value whether the image is active or deleted. This causes an endless loop if a call is waiting on a response of true. Change-Id: I4e6937c992398cfc7db5391cfabb101aaefdb7e6 Closes-Bug: #1557088 Closes-Bug: #1564661 Closes-Bug: #1564614
This commit is contained in:
parent
a16bf19ea9
commit
95dcef21f7
@ -131,8 +131,10 @@ class ImagesClient(base_compute_client.BaseComputeClient):
|
||||
return rest_client.ResponseBody(resp, body)
|
||||
|
||||
def is_resource_deleted(self, id):
|
||||
# Added status check for user with admin role
|
||||
try:
|
||||
self.show_image(id)
|
||||
if self.show_image(id)['image']['status'] == 'DELETED':
|
||||
return True
|
||||
except lib_exc.NotFound:
|
||||
return True
|
||||
return False
|
||||
|
@ -213,7 +213,8 @@ class ImagesClient(rest_client.RestClient):
|
||||
|
||||
def is_resource_deleted(self, id):
|
||||
try:
|
||||
self.get_image_meta(id)
|
||||
if self.get_image_meta(id)['status'] == 'deleted':
|
||||
return True
|
||||
except lib_exc.NotFound:
|
||||
return True
|
||||
return False
|
||||
|
@ -186,7 +186,7 @@ class TestImagesClient(base.BaseComputeServiceTest):
|
||||
|
||||
def _test_resource_deleted(self, bytes_body=False):
|
||||
params = {"id": self.FAKE_IMAGE_ID}
|
||||
expected_op = self.FAKE_IMAGE_DATA['show']['image']
|
||||
expected_op = self.FAKE_IMAGE_DATA['show']
|
||||
self.useFixture(mockpatch.Patch('tempest.lib.services.compute'
|
||||
'.images_client.ImagesClient.show_image',
|
||||
side_effect=lib_exc.NotFound))
|
||||
|
Loading…
Reference in New Issue
Block a user