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):
|
|
|
|
command = ["sudo", "ctr", "images", "pull", "-u", username+":"+password, oci]
|
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
|
|
|
|
|
|
|
def ctr_images_list(oci_ref = None):
|
|
|
|
command = ["sudo", "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))
|
|
|
|
|
|
|
|
|