本文整理汇总了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
示例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
示例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
示例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)