Commit 4f9e4cb2 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Remove "values" term from API

For compatibility with OpenStack Compute API v2, we remove the
term 'values' from all JSON requests and responses.

Refs #3768
parent 5b426e08
......@@ -83,7 +83,7 @@ def list_flavors(request, detail=False):
'flavors': flavors,
'detail': detail})
else:
data = json.dumps({'flavors': {'values': flavors}})
data = json.dumps({'flavors': flavors})
return HttpResponse(data, status=200)
......
......@@ -105,7 +105,7 @@ def image_to_dict(image, detail=True):
d['status'] = 'DELETED' if image['deleted_at'] else 'ACTIVE'
d['progress'] = 100 if image['status'] == 'available' else 0
if image['properties']:
d['metadata'] = {'values': image['properties']}
d['metadata'] = image['properties']
return d
......@@ -135,7 +135,7 @@ def list_images(request, detail=False):
data = render_to_string('list_images.xml',
dict(images=reply, detail=detail))
else:
data = json.dumps(dict(images={'values': reply}))
data = json.dumps(dict(images=reply))
return HttpResponse(data, status=200)
......@@ -210,7 +210,8 @@ def list_metadata(request, image_id):
with image_backend(request.user_uniq) as backend:
image = backend.get_image(image_id)
metadata = image['properties']
return util.render_metadata(request, metadata, use_values=True, status=200)
return util.render_metadata(request, metadata, use_values=False,
status=200)
@api.api_method('POST', user_required=True, logger=log)
......
......@@ -101,7 +101,7 @@ def network_to_dict(network, user_id, detail=True):
for nic in network.nics.filter(machine__userid=user_id)
.filter(state="ACTIVE")
.order_by('machine')]
d['attachments'] = {'values': attachments}
d['attachments'] = attachments
return d
......@@ -142,7 +142,7 @@ def list_networks(request, detail=False):
'networks': networks,
'detail': detail})
else:
data = json.dumps({'networks': {'values': networks}})
data = json.dumps({'networks': networks})
return HttpResponse(data, status=200)
......
......@@ -139,11 +139,11 @@ def vm_to_dict(vm, detail=False):
metadata = dict((m.meta_key, m.meta_value) for m in vm.metadata.all())
if metadata:
d['metadata'] = {'values': metadata}
d['metadata'] = metadata
vm_nics = vm.nics.filter(state="ACTIVE").order_by("index")
attachments = map(nic_to_dict, vm_nics)
d['attachments'] = {'values': attachments}
d['attachments'] = attachments
# include the latest vm diagnostic, if set
diagnostic = vm.get_last_diagnostic()
......@@ -238,7 +238,7 @@ def list_servers(request, detail=False):
'servers': servers,
'detail': detail})
else:
data = json.dumps({'servers': {'values': servers}})
data = json.dumps({'servers': servers})
return HttpResponse(data, status=200)
......@@ -544,7 +544,7 @@ def list_addresses(request, server_id):
if request.serialization == 'xml':
data = render_to_string('list_addresses.xml', {'addresses': addresses})
else:
data = json.dumps({'addresses': {'values': addresses}})
data = json.dumps({'addresses': addresses})
return HttpResponse(data, status=200)
......@@ -585,7 +585,8 @@ def list_metadata(request, server_id):
log.debug('list_server_metadata %s', server_id)
vm = util.get_vm(server_id, request.user_uniq)
metadata = dict((m.meta_key, m.meta_value) for m in vm.metadata.all())
return util.render_metadata(request, metadata, use_values=True, status=200)
return util.render_metadata(request, metadata, use_values=False,
status=200)
@api.api_method(http_method='POST', user_required=True, logger=log)
......
......@@ -85,7 +85,7 @@ def versions_list(request):
if request.serialization == 'xml':
data = render_to_string('versions_list.xml', {'versions': VERSIONS})
else:
data = json.dumps({'versions': {'values': VERSIONS}})
data = json.dumps({'versions': VERSIONS})
return HttpResponse(data)
......
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