Unregister image rest api call has been added.
Change-Id: I1ba1e0ca9e5a6522d268440cd7a0782b95230c4a
This commit is contained in:
@@ -159,6 +159,13 @@ def images_set(image_id, data):
|
||||
return _render_image(image_id, novaclient)
|
||||
|
||||
|
||||
@rest.delete('/images/<image_id>')
|
||||
def images_unset(image_id):
|
||||
novaclient = nova.client()
|
||||
novaclient.images.unset_description(image_id)
|
||||
return u.render()
|
||||
|
||||
|
||||
@rest.post('/images/<image_id>/tag')
|
||||
def image_tags_add(image_id, data):
|
||||
novaclient = nova.client()
|
||||
|
||||
@@ -49,6 +49,9 @@ class SavannaImage(images.Image):
|
||||
def set_description(self, username, description=None):
|
||||
self.manager.set_description(self, username, description)
|
||||
|
||||
def unset_description(self):
|
||||
self.manager.unset_description(self)
|
||||
|
||||
@property
|
||||
def dict(self):
|
||||
return self.to_dict()
|
||||
@@ -83,6 +86,19 @@ class SavannaImageManager(images.ImageManager):
|
||||
PROP_USERNAME: username,
|
||||
})
|
||||
|
||||
def unset_description(self, image):
|
||||
"""Unsets all Savanna-related information.
|
||||
|
||||
It removes username, description and tags from the specified image.
|
||||
"""
|
||||
image = self.get(image)
|
||||
meta = [PROP_TAG + tag for tag in image.tags]
|
||||
if image.description is not None:
|
||||
meta += [PROP_DESCR]
|
||||
if image.username is not None:
|
||||
meta += [PROP_USERNAME]
|
||||
self.delete_meta(image, meta)
|
||||
|
||||
def tag(self, image, tags):
|
||||
"""Adds tags to the specified image."""
|
||||
tags = _ensure_tags(tags)
|
||||
|
||||
Reference in New Issue
Block a user