Set version=auto when creating docker client

When creating a docker client using docker library, version
1.26.0 of docker api is used by default, however the version
of docker included in CentOS 7 is currently 1.24.0. Using
version='auto', the client detects the api version in the
server and uses it.

This change sets version to 'auto' so that is automatically
detected as kolla [1] and others do.

Closes-Bug: #1702765

[1] https://github.com/openstack/kolla/blob/master/kolla/image/build.py#L135

Change-Id: I36d5316ac5244c227f6e9913a58d4fde1c2b1518
This commit is contained in:
Alfredo Moralejo 2017-07-07 08:33:48 +02:00
parent 619239e907
commit d8a74de787
2 changed files with 3 additions and 3 deletions

View File

@ -96,7 +96,7 @@ class DockerImageUploader(ImageUploader):
logger = logging.getLogger(__name__ + '.DockerImageUploader')
def upload_image(self, image_name, pull_source, push_destination):
dockerc = Client(base_url='unix://var/run/docker.sock')
dockerc = Client(base_url='unix://var/run/docker.sock', version='auto')
if ':' in image_name:
image = image_name.rpartition(':')[0]
tag = image_name.rpartition(':')[2]

View File

@ -137,7 +137,7 @@ class TestDockerImageUploader(base.TestCase):
push_destination)
self.dockermock.assert_called_once_with(
base_url='unix://var/run/docker.sock')
base_url='unix://var/run/docker.sock', version='auto')
self.dockermock.return_value.pull.assert_called_once_with(
pull_source + '/' + image,
@ -161,7 +161,7 @@ class TestDockerImageUploader(base.TestCase):
push_destination)
self.dockermock.assert_called_once_with(
base_url='unix://var/run/docker.sock')
base_url='unix://var/run/docker.sock', version='auto')
self.dockermock.return_value.pull.assert_called_once_with(
pull_source + '/' + image,