Upload remove default for pull_source

Currently the pull_source defaults to "docker.io". This is unnecessary
as docker.io is the default registry anyway when no registry is
specified in the namespace.

Also having this default prevents fully qualified image paths being
specified in the imagename. This is desirable now that we use full
paths in the heat parameters.

This also allows the prepare command to deprecate the --pull-source
argument and document having full image paths in the --namespace
argument.

Change-Id: I1769c7cf1c058328a8490228bdc4719e8d216ccb
Partial-Bug: #1708967
This commit is contained in:
Steve Baker 2017-08-21 16:58:09 +12:00
parent 923658a720
commit c58ac826df

View File

@ -51,7 +51,7 @@ class ImageUploadManager(BaseImageManager):
for item in upload_images: for item in upload_images:
image_name = item.get('imagename') image_name = item.get('imagename')
uploader = item.get('uploader', 'docker') uploader = item.get('uploader', 'docker')
pull_source = item.get('pull_source', 'docker.io') pull_source = item.get('pull_source')
push_destination = item.get('push_destination', push_destination = item.get('push_destination',
default_push_destination) default_push_destination)
@ -103,14 +103,17 @@ class DockerImageUploader(ImageUploader):
else: else:
image = image_name image = image_name
tag = 'latest' tag = 'latest'
if pull_source:
repo = pull_source + '/' + image repo = pull_source + '/' + image
else:
repo = image
response = [line for line in dockerc.pull(repo, response = [line for line in dockerc.pull(repo,
tag=tag, stream=True)] tag=tag, stream=True)]
self.logger.debug(response) self.logger.debug(response)
full_image = repo + ':' + tag full_image = repo + ':' + tag
new_repo = push_destination + '/' + image new_repo = push_destination + '/' + repo.partition('/')[2]
response = dockerc.tag(image=full_image, repository=new_repo, response = dockerc.tag(image=full_image, repository=new_repo,
tag=tag, force=True) tag=tag, force=True)
self.logger.debug(response) self.logger.debug(response)