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
评论列表
文章目录