From f53fcc7e5b250118830615a90cc1675032ffd2aa Mon Sep 17 00:00:00 2001 From: Victor Coutellier Date: Sat, 30 Jun 2018 08:32:37 -0400 Subject: [PATCH] Ability to build container against docker swarm Add a decode=True option during call to dockerAPI in order to build container against recent docker swarm. Closes-Bug: #1779460 Change-Id: I48f041e7ed9dd5a5f410b4eaa081f6f013119d17 --- kolla/image/build.py | 18 +++++++++--------- kolla/tests/test_build.py | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/kolla/image/build.py b/kolla/image/build.py index 159fa695df..b198072918 100755 --- a/kolla/image/build.py +++ b/kolla/image/build.py @@ -569,15 +569,15 @@ class BuildTask(DockerTask): buildargs = self.update_buildargs() try: - for response in self.dc.build(path=image.path, - tag=image.canonical_name, - nocache=not self.conf.cache, - rm=True, - network_mode=self.conf.network_mode, - pull=pull, - forcerm=self.forcerm, - buildargs=buildargs): - stream = json.loads(response.decode('utf-8')) + for stream in self.dc.build(path=image.path, + tag=image.canonical_name, + nocache=not self.conf.cache, + rm=True, + decode=True, + network_mode=self.conf.network_mode, + pull=pull, + forcerm=self.forcerm, + buildargs=buildargs): if 'stream' in stream: for line in stream['stream'].split('\n'): if line: diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py index d5c7e77dc4..b721bb237e 100644 --- a/kolla/tests/test_build.py +++ b/kolla/tests/test_build.py @@ -87,7 +87,7 @@ class TasksTest(base.TestCase): builder.run() mock_client().build.assert_called_once_with( - path=self.image.path, tag=self.image.canonical_name, + path=self.image.path, tag=self.image.canonical_name, decode=True, network_mode=None, nocache=False, rm=True, pull=True, forcerm=True, buildargs=None) @@ -104,7 +104,7 @@ class TasksTest(base.TestCase): builder.run() mock_client().build.assert_called_once_with( - path=self.image.path, tag=self.image.canonical_name, + path=self.image.path, tag=self.image.canonical_name, decode=True, network_mode='host', nocache=False, rm=True, pull=True, forcerm=True, buildargs=None) @@ -124,7 +124,7 @@ class TasksTest(base.TestCase): builder.run() mock_client().build.assert_called_once_with( - path=self.image.path, tag=self.image.canonical_name, + path=self.image.path, tag=self.image.canonical_name, decode=True, network_mode=None, nocache=False, rm=True, pull=True, forcerm=True, buildargs=build_args) @@ -143,7 +143,7 @@ class TasksTest(base.TestCase): builder.run() mock_client().build.assert_called_once_with( - path=self.image.path, tag=self.image.canonical_name, + path=self.image.path, tag=self.image.canonical_name, decode=True, network_mode=None, nocache=False, rm=True, pull=True, forcerm=True, buildargs=build_args) @@ -164,7 +164,7 @@ class TasksTest(base.TestCase): builder.run() mock_client().build.assert_called_once_with( - path=self.image.path, tag=self.image.canonical_name, + path=self.image.path, tag=self.image.canonical_name, decode=True, network_mode=None, nocache=False, rm=True, pull=True, forcerm=True, buildargs=build_args)