2020-04-22 10:44:10 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import base
|
|
|
|
import json
|
|
|
|
import docker_api
|
|
|
|
|
|
|
|
def ctr_images_pull(username, password, oci):
|
2021-03-17 15:33:02 +01:00
|
|
|
command = ["ctr", "images", "pull","--snapshotter", "native", "-u", username+":"+password, oci]
|
2020-04-22 10:44:10 +02:00
|
|
|
ret = base.run_command(command)
|
2020-07-30 10:04:14 +02:00
|
|
|
print("Command return: ", ret)
|
2020-04-22 10:44:10 +02:00
|
|
|
|
|
|
|
def ctr_images_list(oci_ref = None):
|
2021-03-17 15:33:02 +01:00
|
|
|
command = ["ctr", "images", "list", "--q"]
|
2020-07-30 10:04:14 +02:00
|
|
|
print("Command: ", command)
|
2020-04-22 10:44:10 +02:00
|
|
|
ret = base.run_command(command)
|
2020-07-30 10:04:14 +02:00
|
|
|
print("Command return: ", ret)
|
2020-04-22 10:44:10 +02:00
|
|
|
if oci_ref is not None and oci_ref not in ret.split("\n"):
|
|
|
|
raise Exception(r" Get OCI ref failed, expected ref is [{}], but return ref list is [{}]".format (ret))
|
|
|
|
|
|
|
|
|