def get(self, context, request_args):
region_id = request_args["region_id"]
cell_id = request_args["cell_id"]
filters = {}
if region_id:
filters['region_id'] = region_id
# TODO(sulo): allow other filters based on services
if cell_id:
filters['cell_id'] = cell_id
try:
hosts_obj = dbapi.hosts_get_all(context, filters)
except exceptions.NotFound:
return self.error_response(404, 'Not Found')
except Exception as err:
LOG.error("Error during host get: %s" % err)
return self.error_response(500, 'Unknown Error')
_inventory = self.generate_ansible_inventory(hosts_obj)
inventory = jsonutils.to_primitive(_inventory)
return inventory, 200, None
评论列表
文章目录