diff --git a/kolla/image/build.py b/kolla/image/build.py index 92a3f3d311..546404ab5a 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 9e44d1bc6b..ab6e374322 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 7d1c0d9dbb..e949f8f5ab 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