web: hosts: Return an object containing hosts list

master
Dustin 2016-01-03 17:14:09 -06:00
parent a73f090fe2
commit 3b8f033253
2 changed files with 10 additions and 4 deletions

View File

@ -33,7 +33,9 @@ class HostListController(controllers.BaseController):
if criteria is not None: if criteria is not None:
hosts = hosts.filter(criteria) hosts = hosts.filter(criteria)
response = request.ResponseClass() response = request.ResponseClass()
response.set_payload(None, hosts.all()) response.set_payload(None, {
'hosts': hosts.all(),
})
return response return response
def POST(self, request): def POST(self, request):

View File

@ -38,6 +38,10 @@ paths:
200: 200:
description: Host list description: Host list
schema: schema:
name: ListOfHosts
type: object
properties:
hosts:
type: array type: array
items: items:
$ref: '#/definitions/Host' $ref: '#/definitions/Host'