Merge "Adds SDK support for `glance cache-delete
`"
This commit is contained in:
commit
cacd5d2f80
@ -82,3 +82,11 @@ Helpers
|
|||||||
.. autoclass:: openstack.image.v2._proxy.Proxy
|
.. autoclass:: openstack.image.v2._proxy.Proxy
|
||||||
:noindex:
|
:noindex:
|
||||||
:members: wait_for_delete
|
:members: wait_for_delete
|
||||||
|
|
||||||
|
|
||||||
|
Cache Operations
|
||||||
|
^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. autoclass:: openstack.image.v2._proxy.Proxy
|
||||||
|
:noindex:
|
||||||
|
:members: cache_delete_image
|
||||||
|
@ -78,6 +78,19 @@ class Proxy(proxy.Proxy):
|
|||||||
def get_image_cache(self):
|
def get_image_cache(self):
|
||||||
return self._get(_cache.Cache, requires_id=False)
|
return self._get(_cache.Cache, requires_id=False)
|
||||||
|
|
||||||
|
def cache_delete_image(self, image, ignore_missing=True):
|
||||||
|
"""Delete an image from cache.
|
||||||
|
|
||||||
|
:param image: The value can be either the name of an image or a
|
||||||
|
:class:`~openstack.image.v2.image.Image`
|
||||||
|
instance.
|
||||||
|
:param bool ignore_missing: When set to ``False``,
|
||||||
|
:class:`~openstack.exceptions.ResourceNotFound` will be raised when
|
||||||
|
the metadef namespace does not exist.
|
||||||
|
:returns: ``None``
|
||||||
|
"""
|
||||||
|
self._delete(_cache.Cache, image, ignore_missing=ignore_missing)
|
||||||
|
|
||||||
# ====== IMAGES ======
|
# ====== IMAGES ======
|
||||||
def create_image(
|
def create_image(
|
||||||
self,
|
self,
|
||||||
|
@ -25,6 +25,7 @@ class Cache(resource.Resource):
|
|||||||
base_path = '/cache'
|
base_path = '/cache'
|
||||||
|
|
||||||
allow_fetch = True
|
allow_fetch = True
|
||||||
|
allow_delete = True
|
||||||
|
|
||||||
_max_microversion = '2.14'
|
_max_microversion = '2.14'
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ class TestCache(base.TestCase):
|
|||||||
self.assertIsNone(sot.resource_key)
|
self.assertIsNone(sot.resource_key)
|
||||||
self.assertEqual('/cache', sot.base_path)
|
self.assertEqual('/cache', sot.base_path)
|
||||||
self.assertTrue(sot.allow_fetch)
|
self.assertTrue(sot.allow_fetch)
|
||||||
|
self.assertTrue(sot.allow_delete)
|
||||||
|
|
||||||
def test_make_it(self):
|
def test_make_it(self):
|
||||||
sot = cache.Cache(**EXAMPLE)
|
sot = cache.Cache(**EXAMPLE)
|
||||||
|
@ -895,3 +895,9 @@ class TestCache(TestImageProxy):
|
|||||||
'requires_id': False
|
'requires_id': False
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_cache_image_delete(self):
|
||||||
|
self.verify_delete(
|
||||||
|
self.proxy.cache_delete_image,
|
||||||
|
_cache.Cache,
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user