Commit ec52784d authored by Giorgos Verigakis's avatar Giorgos Verigakis
Browse files

Allow more than one metadata updates at the time

Refs #1399
parent 054e60c0
......@@ -245,9 +245,9 @@ class Client(object):
reply = self._put(path, body, 201)
return reply['meta']
def update_server_metadata(self, server_id, key, val):
def update_server_metadata(self, server_id, **metadata):
path = '/servers/%d/meta' % server_id
body = json.dumps({'metadata': {key: val}})
body = json.dumps({'metadata': metadata})
reply = self._post(path, body, 201)
return reply['metadata']
......@@ -309,9 +309,9 @@ class Client(object):
reply = self._put(path, body, 201)
reply['meta']
def update_image_metadata(self, image_id, key, val):
def update_image_metadata(self, image_id, **metadata):
path = '/images/%d/meta' % image_id
body = json.dumps({'metadata': {key: val}})
body = json.dumps({'metadata': metadata})
reply = self._post(path, body, 201)
return reply['metadata']
......
......@@ -387,7 +387,8 @@ class UpdateServerMetadata(Command):
description = 'update server metadata'
def main(self, server_id, key, val):
reply = self.client.update_server_metadata(int(server_id), key, val)
metadata = {key: val}
reply = self.client.update_server_metadata(int(server_id), **metadata)
print_dict(reply)
......@@ -515,7 +516,8 @@ class UpdateImageMetadata(Command):
description = 'update image metadata'
def main(self, image_id, key, val):
reply = self.client.update_image_metadata(int(image_id), key, val)
metadata = {key: val}
reply = self.client.update_image_metadata(int(image_id), **metadata)
print_dict(reply)
......
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