当前位置: 首页>>代码示例>>Python>>正文


Python Trust.discover_sigstore方法代码示例

本文整理汇总了Python中Atomic.trust.Trust.discover_sigstore方法的典型用法代码示例。如果您正苦于以下问题:Python Trust.discover_sigstore方法的具体用法?Python Trust.discover_sigstore怎么用?Python Trust.discover_sigstore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Atomic.trust.Trust的用法示例。


在下文中一共展示了Trust.discover_sigstore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pull_image

# 需要导入模块: from Atomic.trust import Trust [as 别名]
# 或者: from Atomic.trust.Trust import discover_sigstore [as 别名]
    def pull_image(self, image, remote_image_obj, **kwargs):
        assert(isinstance(remote_image_obj, Image))
        debug = kwargs.get('debug', False)
        if image.startswith("dockertar:"):
            path = image.replace("dockertar:", "", 1)
            with open(path, 'rb') as f:
                self.d.load_image(data=f)
            return 0
        fq_name = remote_image_obj.fq_name
        local_image = self.has_image(image)
        if local_image is not None:
            if self.already_has_image(local_image, remote_image_obj):
                raise util.ImageAlreadyExists(image)
        registry, _, _, tag, _ = util.Decompose(fq_name).all
        image = "docker-daemon:{}".format(fq_name)
        if not image.endswith(tag):
            image += ":{}".format(tag)
        if '@sha256:' in image:
            image = image.replace("@sha256:", ":")

        src_creds = kwargs.get('src_creds')
        insecure = True if util.is_insecure_registry(self.d.info()['RegistryConfig'], registry) else False
        trust = Trust()
        trust.discover_sigstore(fq_name)
        util.write_out("Pulling {} ...".format(fq_name))
        util.skopeo_copy("docker://{}".format(fq_name), image, debug=debug, insecure=insecure,
                         policy_filename=trust.policy_filename, src_creds=src_creds)
        return 0
开发者ID:vcgato29,项目名称:atomic,代码行数:30,代码来源:_docker.py

示例2: pull_image

# 需要导入模块: from Atomic.trust import Trust [as 别名]
# 或者: from Atomic.trust.Trust import discover_sigstore [as 别名]
 def pull_image(self, image, **kwargs):
     debug = kwargs.get("debug", False)
     if image.startswith("dockertar:"):
         path = image.replace("dockertar:", "", 1)
         with open(path, "rb") as f:
             self.d.load_image(data=f)
         return 0
     remote_image = self.make_remote_image(image)
     fq_name = remote_image.fq_name
     local_image = self.has_image(image)
     if local_image is not None:
         if self.already_has_image(local_image, remote_image):
             raise ValueError("Latest version of {} already present.".format(image))
     registry, _, _, tag, _ = util.Decompose(fq_name).all
     image = "docker-daemon:{}".format(image)
     if not image.endswith(tag):
         image += ":{}".format(tag)
     insecure = (
         True if util.is_insecure_registry(self.d.info()["RegistryConfig"], util.strip_port(registry)) else False
     )
     trust = Trust()
     trust.discover_sigstore(fq_name)
     util.write_out("Pulling {} ...".format(fq_name))
     util.skopeo_copy(
         "docker://{}".format(fq_name), image, debug=debug, insecure=insecure, policy_filename=trust.policy_filename
     )
     return 0
开发者ID:yuqi-zhang,项目名称:atomic,代码行数:29,代码来源:_docker.py

示例3: pull_image

# 需要导入模块: from Atomic.trust import Trust [as 别名]
# 或者: from Atomic.trust.Trust import discover_sigstore [as 别名]
    def pull_image(self, image, remote_image_obj, **kwargs):
        """
        Pulls an image to the backend
        :param image:
        :param pull_args:
        :return:
        """
        debug = kwargs.get('debug', False)
        fq_name = remote_image_obj.fq_name
        registry, _, _, tag, _ = util.Decompose(fq_name).all
        if not image.endswith(tag):
            image += ":{}".format(tag)
        if '@sha256:' in image:
            image = image.replace("@sha256:", ":")

        insecure = False
        registries_config = util.load_registries_from_yaml()
        if "insecure_registries" in registries_config:
            if registry in registries_config['insecure_registries']:
                insecure = True
        source = "docker://{}".format(image)
        dest = "containers-storage:{}".format(image)
        trust = Trust()
        trust.discover_sigstore(fq_name)
        util.write_out("Pulling {} ...".format(fq_name))
        util.skopeo_copy(source, dest, debug=debug, insecure=insecure, policy_filename=trust.policy_filename)
        return 0
开发者ID:jlebon,项目名称:atomic,代码行数:29,代码来源:_containers_storage.py

示例4: pull_image

# 需要导入模块: from Atomic.trust import Trust [as 别名]
# 或者: from Atomic.trust.Trust import discover_sigstore [as 别名]
    def pull_image(self, image, pull_args):
        # Add this when atomic registry is incorporated.
        # if self.args.reg_type == "atomic":
        #     pull_uri = 'atomic:'
        # else:
        #     pull_uri = 'docker://'
        img_obj = self._make_remote_image(image)
        fq_name = img_obj.fq_name
        insecure = True if util.is_insecure_registry(self.d.info()['RegistryConfig'], util.strip_port(img_obj.registry)) else False

        # This needs to be re-enabled with Aaron's help
        trust = Trust()
        trust.set_args(pull_args)
        trust.discover_sigstore(fq_name)

        util.write_out("Pulling {} ...".format(fq_name))
        util.skopeo_copy("docker://{}".format(fq_name),
                         "docker-daemon:{}".format(image),
                         debug=pull_args.debug, insecure=insecure,
                         policy_filename=pull_args.policy_filename)
开发者ID:baude,项目名称:atomic,代码行数:22,代码来源:_docker.py


注:本文中的Atomic.trust.Trust.discover_sigstore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。