예제 #1
0
파일: images.py 프로젝트: shaisxx/zun
    def get_one(self, image_id):
        """Retrieve information about the given image.

        :param image_id: UUID of a image.
        """
        image = utils.get_image(image_id)
        check_policy_on_image(image.as_dict(), "image:get_one")
        return view.format_image(pecan.request.host_url, image)
예제 #2
0
파일: images.py 프로젝트: openstack/higgins
    def get_one(self, image_id):
        """Retrieve information about the given image.

        :param image_id: UUID of a image.
        """
        image = utils.get_image(image_id)
        check_policy_on_image(image.as_dict(), "image:get_one")
        return view.format_image(pecan.request.host_url, image)
예제 #3
0
파일: images.py 프로젝트: zwphit/zun
 def convert_with_links(rpc_images,
                        limit,
                        url=None,
                        expand=False,
                        **kwargs):
     collection = ImageCollection()
     collection.images = [view.format_image(url, p) for p in rpc_images]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection
예제 #4
0
파일: images.py 프로젝트: zwphit/zun
    def post(self, **image_dict):
        """Create a new image.

        :param image: an image within the request body.
        """
        context = pecan.request.context
        policy.enforce(context, "image:pull", action="image:pull")
        image_dict['project_id'] = context.project_id
        image_dict['user_id'] = context.user_id
        repo_tag = image_dict.get('repo')
        image_dict['repo'], image_dict['tag'] = utils.parse_image_name(
            repo_tag)
        new_image = objects.Image(context, **image_dict)
        new_image.pull(context)
        pecan.request.compute_api.image_pull(context, new_image)
        # Set the HTTP Location Header
        pecan.response.location = link.build_url('images', new_image.uuid)
        pecan.response.status = 202
        return view.format_image(pecan.request.host_url, new_image)
예제 #5
0
파일: images.py 프로젝트: openstack/higgins
    def post(self, **image_dict):
        """Create a new image.

        :param image_dict: an image within the request body.
        """
        context = pecan.request.context
        policy.enforce(context, "image:pull",
                       action="image:pull")
        host = _get_host(image_dict.pop('host'))
        image_dict['project_id'] = context.project_id
        image_dict['user_id'] = context.user_id
        repo_tag = image_dict.get('repo')
        image_dict['host'] = host.hostname
        image_dict['repo'], image_dict['tag'] = utils.parse_image_name(
            repo_tag)
        new_image = objects.Image(context, **image_dict)
        new_image.pull(context)
        pecan.request.compute_api.image_pull(context, new_image)
        # Set the HTTP Location Header
        pecan.response.location = link.build_url('images', new_image.uuid)
        pecan.response.status = 202
        return view.format_image(pecan.request.host_url, new_image)
예제 #6
0
파일: images.py 프로젝트: openstack/higgins
 def convert_with_links(rpc_images, limit, url=None,
                        expand=False, **kwargs):
     collection = ImageCollection()
     collection.images = [view.format_image(url, p) for p in rpc_images]
     collection.next = collection.get_next(limit, url=url, **kwargs)
     return collection