Merge "synchronize registry/api/v1/hosts.py"

This commit is contained in:
Jenkins
2017-02-08 09:21:16 +00:00
committed by Gerrit Code Review
2 changed files with 2 additions and 11 deletions

View File

@@ -711,7 +711,7 @@ class Controller(controller.BaseController):
extension = importutils.import_module(
'daisy.api.v1.ext.%s' % ext_func)
if 'complement_host_extra_info' in dir(extension):
extension.complement_host_extra_info(host_meta)
extension.complement_host_extra_info(req, host_meta)
os_handle = get_os_handle()
os_handle.check_discover_state(req,

View File

@@ -116,6 +116,7 @@ class Controller(object):
params = self._get_query_params(req)
nodes = self._get_hosts(req.context, **params)
nodes.sort(key=lambda x: x['name'])
return dict(nodes=nodes)
@@ -386,16 +387,8 @@ class Controller(object):
@utils.mutating
def get_host(self, req, id):
"""Return data about the given node id."""
os_version_dict = {}
try:
host_data = self.db_api.host_get(req.context, id)
if utils.is_uuid_like(host_data.os_version_id):
version = self.db_api.get_os_version(
req.context, host_data.os_version_id)
if version:
os_version_dict['name'] = version.name
os_version_dict['id'] = version.id
os_version_dict['desc'] = version.description
msg = "Successfully retrieved host %(id)s" % {'id': id}
LOG.debug(msg)
except exception.NotFound:
@@ -440,8 +433,6 @@ class Controller(object):
host_data = dict(host=host_data)
if host_interface:
host_data['host']['interfaces'] = host_interface
if os_version_dict:
host_data['host']['os_version'] = os_version_dict
if role_name:
host_data['host']['role'] = role_name
host_data['host']['deployment_backends'] = backends