예제 #1
0
def pull_image(host_id, image_name):
    try:
        _image = Image_Module()

        if not _image.set_host(host_id).check_health():
            return {
                "status": "failed",
                "result": {
                    "error": _("Error, Unable to connect to docker host!")
                },
                "notify_type": "failed"
            }

        image_name = image_name.split(":")
        result = _image.pull(
            image_name[0],
            image_name[1]
        )
        if result:
            return {
                "status": "passed",
                "result": "{}",
                "notify_type": "passed"
            }
        else:
            return {
                "status": "failed",
                "result": "{}",
                "notify_type": "failed"
            }

    except Exception as e:
        return {
            "status": "error",
            "result": {
                "error": str(e)
            },
            "notify_type": "error"
        }
예제 #2
0
파일: host.py 프로젝트: megamcloud/Kraven
 def pull_image(self, configs={}):
     _image = Image_Module()
     if _image.set_host(configs["host_id"]).check_health():
         print(_image.pull(configs["repository"], configs["tag"]))