Merge pull request #5863 from docker/bump-1.21.0

Bump 1.21.0
This commit is contained in:
Joffrey F 2018-04-10 13:34:44 -07:00 committed by GitHub
commit d787f2572b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 9 deletions

View File

@ -1,7 +1,7 @@
Change log Change log
========== ==========
1.21.0 (2018-04-11) 1.21.0 (2018-04-10)
------------------- -------------------
### New features ### New features

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import from __future__ import absolute_import
from __future__ import unicode_literals from __future__ import unicode_literals
__version__ = '1.21.0-rc1' __version__ = '1.21.0'

View File

@ -279,9 +279,7 @@ class ParallelStreamWriter(object):
def write_initial(self, msg, obj_index): def write_initial(self, msg, obj_index):
if msg is None: if msg is None:
return return
self.stream.write("{:<{width}} ... \r\n".format( return self._write_noansi(msg, obj_index, '')
msg + ' ' + obj_index, width=self.width))
self.stream.flush()
def _write_ansi(self, msg, obj_index, status): def _write_ansi(self, msg, obj_index, status):
self.lock.acquire() self.lock.acquire()
@ -299,8 +297,11 @@ class ParallelStreamWriter(object):
self.lock.release() self.lock.release()
def _write_noansi(self, msg, obj_index, status): def _write_noansi(self, msg, obj_index, status):
self.stream.write("{:<{width}} ... {}\r\n".format(msg + ' ' + obj_index, self.stream.write(
status, width=self.width)) "{:<{width}} ... {}\r\n".format(
msg + ' ' + obj_index, status, width=self.width
)
)
self.stream.flush() self.stream.flush()
def write(self, msg, obj_index, status, color_func): def write(self, msg, obj_index, status, color_func):

View File

@ -556,7 +556,11 @@ class Project(object):
limit=5, limit=5,
) )
if len(errors): if len(errors):
raise ProjectError(b"\n".join(errors.values())) combined_errors = '\n'.join([
e.decode('utf-8') if isinstance(e, six.binary_type) else e for e in errors.values()
])
raise ProjectError(combined_errors)
else: else:
for service in services: for service in services:
service.pull(ignore_pull_failures, silent=silent) service.pull(ignore_pull_failures, silent=silent)

View File

@ -15,7 +15,7 @@
set -e set -e
VERSION="1.21.0-rc1" VERSION="1.21.0"
IMAGE="docker/compose:$VERSION" IMAGE="docker/compose:$VERSION"

View File

@ -5,6 +5,7 @@ from __future__ import unicode_literals
import datetime import datetime
import docker import docker
import pytest
from docker.errors import NotFound from docker.errors import NotFound
from .. import mock from .. import mock
@ -16,8 +17,10 @@ from compose.const import COMPOSEFILE_V2_0 as V2_0
from compose.const import COMPOSEFILE_V2_4 as V2_4 from compose.const import COMPOSEFILE_V2_4 as V2_4
from compose.const import LABEL_SERVICE from compose.const import LABEL_SERVICE
from compose.container import Container from compose.container import Container
from compose.errors import OperationFailedError
from compose.project import NoSuchService from compose.project import NoSuchService
from compose.project import Project from compose.project import Project
from compose.project import ProjectError
from compose.service import ImageType from compose.service import ImageType
from compose.service import Service from compose.service import Service
@ -588,3 +591,29 @@ class ProjectTest(unittest.TestCase):
name='test', client=self.mock_client, config_data=config_data, default_platform='windows' name='test', client=self.mock_client, config_data=config_data, default_platform='windows'
) )
assert project.get_service('web').options.get('platform') == 'linux/s390x' assert project.get_service('web').options.get('platform') == 'linux/s390x'
@mock.patch('compose.parallel.ParallelStreamWriter._write_noansi')
def test_error_parallel_pull(self, mock_write):
project = Project.from_config(
name='test',
client=self.mock_client,
config_data=Config(
version=V2_0,
services=[{
'name': 'web',
'image': 'busybox:latest',
}],
networks=None,
volumes=None,
secrets=None,
configs=None,
),
)
self.mock_client.pull.side_effect = OperationFailedError('pull error')
with pytest.raises(ProjectError):
project.pull(parallel_pull=True)
self.mock_client.pull.side_effect = OperationFailedError(b'pull error')
with pytest.raises(ProjectError):
project.pull(parallel_pull=True)