def get(self, context, id, request_args): """Get host by given id""" host_obj = dbapi.hosts_get_by_id(context, id) host = utils.get_resource_with_vars(request_args, host_obj) utils.add_up_link(context, host) return host, 200, None
def get(self, id): """Get host by given id""" context = request.environ.get('context') resolved_values = g.args["resolved-values"] host_obj = dbapi.hosts_get_by_id(context, id) if resolved_values: host_obj.data = host_obj.resolved else: host_obj.data = host_obj.variables host_obj.labels = host_obj.labels return jsonutils.to_primitive(host_obj), 200, None
def get(self, id): """Get host by given id""" context = request.environ.get('context') resolved_values = g.args["resolved-values"] host_obj = dbapi.hosts_get_by_id(context, id) if resolved_values: host_obj.data = host_obj.resolved else: host_obj.data = host_obj.variables host_obj.labels = host_obj.labels host = jsonutils.to_primitive(host_obj) return host, 200, None
def get(self, id): """Get host by given id""" context = request.environ.get('context') try: host_obj = dbapi.hosts_get_by_id(context, id) 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') host_obj.data = host_obj.variables host_obj.labels = host_obj.labels host = jsonutils.to_primitive(host_obj) return host, 200, None
def get(self, id): """Get labels for given host device.""" context = request.environ.get('context') host_obj = dbapi.hosts_get_by_id(context, id) response = {"labels": list(host_obj.labels)} return response, 200, None
def get(self, id): """Get data for given host.""" context = request.environ.get('context') obj = dbapi.hosts_get_by_id(context, id) response = {"data": jsonutils.to_primitive(obj.variables)} return response, 200, None
def get(self, context, id): """Get labels for given host device.""" host_obj = dbapi.hosts_get_by_id(context, id) response = {"labels": list(host_obj.labels)} return response, 200, None