commands.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:docl 作者: cloudify-cosmo 项目源码 文件源码
def pull_image(no_progress=False):
    # try contacting the docker daemon first, to break early if it's not
    # reachable - before the long download
    quiet_docker.version()

    online_sha1 = requests.get(
        configuration.manager_image_commit_sha_url).text.strip()
    local_sha1 = work.last_pulled_image_commit_sha1
    if online_sha1 == local_sha1:
        logger.info('Current image is the latest image. It is based on the '
                    'following commit in the manager blueprints repo: {}'
                    .format(local_sha1))
        return
    logger.info('Download manager image from {} to {}'
                .format(configuration.manager_image_url,
                        work.pulled_image_path))
    if os.path.exists(work.pulled_image_path):
        os.remove(work.pulled_image_path)
    files.download(url=configuration.manager_image_url,
                   output_path=work.pulled_image_path,
                   no_progress=no_progress)
    logger.info('Loading image into docker (may take a while)')
    quiet_docker.load(gzip('-dc', work.pulled_image_path,
                           _piped=True,
                           _out_bufsize=constants.BUFFER_SIZE),
                      _in_bufsize=constants.BUFFER_SIZE)
    work.last_pulled_image_commit_sha1 = online_sha1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号