def get_container(container_ident): container = api_utils.get_resource('Container', container_ident) if not container: pecan.abort(404, ('Not found; the container you requested ' 'does not exist.')) return container
def _get_host(host_ident): host = api_utils.get_resource('ComputeNode', host_ident) if not host: pecan.abort(404, ('Not found; the host you requested ' 'does not exist.')) return host
def _get_capsule(capsule_ident): """Get capsule by name or UUID""" capsule = api_utils.get_resource('Capsule', capsule_ident) if not capsule: pecan.abort(404, ('Not found; the capsule you requested ' 'does not exist.')) return capsule
def _get_container(container_id): container = api_utils.get_resource('Container', container_id) if not container: pecan.abort(404, ('Not found; the container you requested ' 'does not exist.')) return container
def get_image(image_id): image = api_utils.get_resource('Image', image_id) if not image: pecan.abort(404, ('Not found; the image you requested ' 'does not exist.')) return image
def _get_host(host_ident): host = api_utils.get_resource('ComputeNode', host_ident) if not host: pecan.abort(404, ('Not found; the host you requested ' 'does not exist.')) return host
def get_image(image_id): image = api_utils.get_resource('Image', image_id) if not image: pecan.abort(404, ('Not found; the image you requested ' 'does not exist.')) return image
def _get_capsule(capsule_ident): """Get capsule by name or UUID""" capsule = api_utils.get_resource('Capsule', capsule_ident) if not capsule: pecan.abort(404, ('Not found; the capsule you requested ' 'does not exist.')) return capsule
def get_one(self, image_id): """Retrieve information about the given image. :param image_id: UUID of a image. """ image = api_utils.get_resource('Image', image_id) check_policy_on_image(image.as_dict(), "image:get_one") return view.format_image(pecan.request.host_url, image)
def _do_get_one(self, capsule_ident, legacy_api_version=False): context = pecan.request.context capsule = api_utils.get_resource('Capsule', capsule_ident) check_policy_on_capsule(capsule.as_dict(), "capsule:get") return view.format_capsule(pecan.request.host_url, capsule, context, legacy_api_version=legacy_api_version)
def get_one(self, host_ident): """Retrieve information about the given host. :param host_ident: UUID or name of a host. """ context = pecan.request.context policy.enforce(context, "host:get", action="host:get") host = api_utils.get_resource('ComputeNode', host_ident) return view.format_host(pecan.request.host_url, host)
def delete(self, capsule_ident, **kwargs): """Delete a capsule. :param capsule_ident: UUID or Name of a capsule. """ context = pecan.request.context if utils.is_all_projects(kwargs): policy.enforce(context, "capsule:delete_all_projects", action="capsule:delete_all_projects") context.all_projects = True capsule = api_utils.get_resource('Capsule', capsule_ident) check_policy_on_capsule(capsule.as_dict(), "capsule:delete") compute_api = pecan.request.compute_api capsule.task_state = consts.CONTAINER_DELETING capsule.save(context) if capsule.host: compute_api.container_delete(context, capsule) else: merged_containers = capsule.containers + capsule.init_containers for container in merged_containers: container.destroy(context) capsule.destroy(context) pecan.response.status = 204
def delete(self, image_id): context = pecan.request.context policy.enforce(context, "image:delete", action="image:delete") image = api_utils.get_resource('Image', image_id) return pecan.request.compute_api.image_delete(context, image)
def _get_host(host_ident): try: return api_utils.get_resource('ComputeNode', host_ident) except exception.ComputeNodeNotFound: msg = _("The host %s does not exist.") % host_ident raise exception.InvalidValue(msg)
def get_registry(registry_id): registry = api_utils.get_resource('Registry', registry_id) if not registry: raise exception.RegistryNotFound(registry=registry_id) return registry
def get_registry(registry_id): registry = api_utils.get_resource('Registry', registry_id) if not registry: raise exception.RegistryNotFound(registry=registry_id) return registry
def _get_host(host_ident): try: return api_utils.get_resource('ComputeNode', host_ident) except exception.ComputeNodeNotFound: msg = _("The host %s does not exist.") % host_ident raise exception.InvalidValue(msg)
def _get_capsule(capsule_id): capsule = api_utils.get_resource('Capsule', capsule_id) if not capsule: pecan.abort(404, ('Not found; the capsule you requested ' 'does not exist.')) return capsule