summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. Jens Harbott <harbott@osism.tech>2022-08-22 14:15:02 +0200
committerDr. Jens Harbott <harbott@osism.tech>2022-08-22 14:15:02 +0200
commit0fc8712cace61aee19335951409068cef8009dba (patch)
tree4af76674cb1b9d517daab96e9ebf49bc5750dfeb
parent3e5369db541c60df6d5cddccc20b04f50a3d45ad (diff)
downloadkolla-0fc8712cace61aee19335951409068cef8009dba.tar.gz
kolla-0fc8712cace61aee19335951409068cef8009dba.zip
Bump minimum docker-py version
With version 6.0.0 of the docker python module, their implementation of versioning has changed, making our check for old versions fail. Since version 3.0.0 is from 2018, we should be safe to assume that as a minimum version though, so we can just get rid of the special handling of older versions. Change-Id: I077b7b5acf2c1f9beb6da06d3555e2ebe30831d1
-rwxr-xr-xkolla/image/build.py7
-rw-r--r--kolla/tests/test_build.py16
-rw-r--r--requirements.txt2
3 files changed, 1 insertions, 24 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py
index 92a3f3d31..546404ab5 100755
--- a/kolla/image/build.py
+++ b/kolla/image/build.py
@@ -28,7 +28,6 @@ import tempfile
import threading
import time
-from distutils.version import StrictVersion
import docker
from enum import Enum
import git
@@ -264,12 +263,6 @@ class PushTask(DockerTask):
def push_image(self, image):
kwargs = dict(stream=True, decode=True)
- # Since docker 3.0.0, the argument of 'insecure_registry' is removed.
- # To be compatible, set 'insecure_registry=True' for old releases.
- dc_running_ver = StrictVersion(docker.version)
- if dc_running_ver < StrictVersion('3.0.0'):
- kwargs['insecure_registry'] = True
-
for response in self.dc.push(image.canonical_name, **kwargs):
if 'stream' in response:
self.logger.info(response['stream'])
diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py
index 9e44d1bc6..ab6e37432 100644
--- a/kolla/tests/test_build.py
+++ b/kolla/tests/test_build.py
@@ -59,18 +59,6 @@ class TasksTest(base.TestCase):
self.imageChild.parent = self.image
self.imageChild.path = self.useFixture(fixtures.TempDir()).path
- @mock.patch('docker.version', '2.7.0')
- @mock.patch.dict(os.environ, clear=True)
- @mock.patch('docker.APIClient')
- def test_push_image_before_v3_0_0(self, mock_client):
- self.dc = mock_client
- pusher = build.PushTask(self.conf, self.image)
- pusher.run()
- mock_client().push.assert_called_once_with(
- self.image.canonical_name, decode=True,
- stream=True, insecure_registry=True)
-
- @mock.patch('docker.version', '3.0.0')
@mock.patch.dict(os.environ, clear=True)
@mock.patch('docker.APIClient')
def test_push_image(self, mock_client):
@@ -81,7 +69,6 @@ class TasksTest(base.TestCase):
self.image.canonical_name, decode=True, stream=True)
self.assertTrue(pusher.success)
- @mock.patch('docker.version', '3.0.0')
@mock.patch.dict(os.environ, clear=True)
@mock.patch('docker.APIClient')
def test_push_image_failure(self, mock_client):
@@ -95,7 +82,6 @@ class TasksTest(base.TestCase):
self.assertFalse(pusher.success)
self.assertEqual(build.Status.PUSH_ERROR, self.image.status)
- @mock.patch('docker.version', '3.0.0')
@mock.patch.dict(os.environ, clear=True)
@mock.patch('docker.APIClient')
def test_push_image_failure_retry(self, mock_client):
@@ -116,7 +102,6 @@ class TasksTest(base.TestCase):
self.assertTrue(pusher.success)
self.assertEqual(build.Status.BUILT, self.image.status)
- @mock.patch('docker.version', '3.0.0')
@mock.patch.dict(os.environ, clear=True)
@mock.patch('docker.APIClient')
def test_push_image_failure_error(self, mock_client):
@@ -131,7 +116,6 @@ class TasksTest(base.TestCase):
self.assertFalse(pusher.success)
self.assertEqual(build.Status.PUSH_ERROR, self.image.status)
- @mock.patch('docker.version', '3.0.0')
@mock.patch.dict(os.environ, clear=True)
@mock.patch('docker.APIClient')
def test_push_image_failure_error_retry(self, mock_client):
diff --git a/requirements.txt b/requirements.txt
index 7d1c0d9db..e949f8f5a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
pbr!=2.1.0,>=2.0.0 # Apache-2.0
-docker>=2.4.2 # Apache-2.0
+docker>=3.0.0 # Apache-2.0
Jinja2>=3.0.1 # BSD License (3 clause)
GitPython>=1.0.1 # BSD License (3 clause)
oslo.config>=5.1.0 # Apache-2.0