Commit bcebdfef authored by Stavros Sachtouris's avatar Stavros Sachtouris

New image method: reregister(location[, ...])

parent ca30409e
......@@ -131,6 +131,15 @@ class image_test(_init_image):
print('OK...')
@command(image_cmds)
class image_rere(_init_image):
"""Re-Register an image, dude"""
def main(self, location):
super(self.__class__, self).main()
self.client.reregister(location)
@command(image_cmds)
class image_register(_init_image):
"""Register an image"""
......
......@@ -101,6 +101,17 @@ class ImageClient(Client):
r = self.post(path, success=200)
r.release()
def reregister(self, location, name=None, params={}, properties={}):
path = path4url('images', 'detail')
r = self.get(path, success=200)
imgs = [img for img in r.json if img['location'] == location]
for img in imgs:
img_name = name if name else img['name']
img_properties = img['properties']
for k, v in properties.items():
img_properties[k] = v
self.register(img_name, location, params, img_properties)
def list_members(self, image_id):
path = path4url('images', image_id, 'members')
r = self.get(path, success=200)
......
......@@ -202,7 +202,6 @@ class testImage(unittest.TestCase):
for interm in ('kernel',
'osfamily',
'users',
'partition-table',
'gui', 'sortorder',
'root-partition',
'os',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment