Reactivating admin public image returns 500
The actual call is reactivate not activate. Therefore to stop the internal server error occuring the activate needs to be renamed. Change-Id: I9c74a3cd2bd460c6947477052af07838ef278d59 Closes-bug: 1515305
This commit is contained in:
parent
9786b975f8
commit
fcbfddd590
|
@ -332,8 +332,8 @@ class ImmutableImageProxy(object):
|
|||
message = _("You are not permitted to deactivate this image.")
|
||||
raise exception.Forbidden(message)
|
||||
|
||||
def activate(self, *args, **kwargs):
|
||||
message = _("You are not permitted to activate this image.")
|
||||
def reactivate(self, *args, **kwargs):
|
||||
message = _("You are not permitted to reactivate this image.")
|
||||
raise exception.Forbidden(message)
|
||||
|
||||
|
||||
|
|
|
@ -479,6 +479,26 @@ class TestImages(functional.FunctionalTest):
|
|||
response = requests.post(path, data={}, headers=self._headers())
|
||||
self.assertEqual(204, response.status_code)
|
||||
|
||||
# Change the image to public so TENANT2 can see it
|
||||
path = self._url('/v2/images/%s' % image_id)
|
||||
media_type = 'application/openstack-images-v2.0-json-patch'
|
||||
headers = self._headers({'content-type': media_type})
|
||||
data = jsonutils.dumps([{"replace": "/visibility", "value": "public"}])
|
||||
response = requests.patch(path, headers=headers, data=data)
|
||||
self.assertEqual(200, response.status_code, response.text)
|
||||
|
||||
# Tennant2 should get Forbidden when deactivating the public image
|
||||
path = self._url('/v2/images/%s/actions/deactivate' % image_id)
|
||||
response = requests.post(path, data={}, headers=self._headers(
|
||||
{'X-Tenant-Id': TENANT2}))
|
||||
self.assertEqual(403, response.status_code)
|
||||
|
||||
# Tennant2 should get Forbidden when reactivating the public image
|
||||
path = self._url('/v2/images/%s/actions/reactivate' % image_id)
|
||||
response = requests.post(path, data={}, headers=self._headers(
|
||||
{'X-Tenant-Id': TENANT2}))
|
||||
self.assertEqual(403, response.status_code)
|
||||
|
||||
# Deactivating a deactivated image succeeds (no-op)
|
||||
path = self._url('/v2/images/%s/actions/deactivate' % image_id)
|
||||
response = requests.post(path, data={}, headers=self._headers())
|
||||
|
|
|
@ -771,8 +771,8 @@ class TestImmutableImage(utils.BaseTestCase):
|
|||
def test_deactivate_image(self):
|
||||
self.assertRaises(exception.Forbidden, self.image.deactivate)
|
||||
|
||||
def test_activate_image(self):
|
||||
self.assertRaises(exception.Forbidden, self.image.activate)
|
||||
def test_reactivate_image(self):
|
||||
self.assertRaises(exception.Forbidden, self.image.reactivate)
|
||||
|
||||
def test_get_data(self):
|
||||
class FakeImage(object):
|
||||
|
|
Loading…
Reference in New Issue