summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-03-28 16:44:20 +0000
committerGerrit Code Review <review@openstack.org>2013-03-28 16:44:20 +0000
commitec9494d0d47494f195c292619529fe2dd00697bb (patch)
tree79196bcd644977f10832c3853e4420342a75abbf /nova/api
parent7f4589ea7886559918b1c7e0a38384f3d710fca3 (diff)
parent48b41e0b880adf80e3be6d128cd392af57b8477e (diff)
Merge "Fix typo in the XML serialization os-services API."
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/services.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/nova/api/openstack/compute/contrib/services.py b/nova/api/openstack/compute/contrib/services.py
index 558c31586..5b382f892 100644
--- a/nova/api/openstack/compute/contrib/services.py
+++ b/nova/api/openstack/compute/contrib/services.py
@@ -42,14 +42,14 @@ class ServicesIndexTemplate(xmlutil.TemplateBuilder):
elem.set('zone')
elem.set('status')
elem.set('state')
- elem.set('update_at')
+ elem.set('updated_at')
return xmlutil.MasterTemplate(root, 1)
-class ServicesUpdateTemplate(xmlutil.TemplateBuilder):
+class ServiceUpdateTemplate(xmlutil.TemplateBuilder):
def construct(self):
- root = xmlutil.TemplateElement('host')
+ root = xmlutil.TemplateElement('service', selector='service')
root.set('host')
root.set('binary')
root.set('status')
@@ -57,6 +57,19 @@ class ServicesUpdateTemplate(xmlutil.TemplateBuilder):
return xmlutil.MasterTemplate(root, 1)
+class ServiceUpdateDeserializer(wsgi.XMLDeserializer):
+ def default(self, string):
+ node = xmlutil.safe_minidom_parse_string(string)
+ service = {}
+ service_node = self.find_first_child_named(node, 'service')
+ if service_node is None:
+ return service
+ service['host'] = service_node.getAttribute('host')
+ service['binary'] = service_node.getAttribute('binary')
+
+ return dict(body=service)
+
+
class ServiceController(object):
def __init__(self):
@@ -98,7 +111,8 @@ class ServiceController(object):
'updated_at': svc['updated_at']})
return {'services': svcs}
- @wsgi.serializers(xml=ServicesUpdateTemplate)
+ @wsgi.deserializers(xml=ServiceUpdateDeserializer)
+ @wsgi.serializers(xml=ServiceUpdateTemplate)
def update(self, req, id, body):
"""Enable/Disable scheduling for a service."""
context = req.environ['nova.context']
@@ -110,7 +124,6 @@ class ServiceController(object):
disabled = True
else:
raise webob.exc.HTTPNotFound("Unknown action")
-
try:
host = body['host']
binary = body['binary']