From f10c008aa57c4c48cce1a718a0160a54a2b1a371 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Mon, 18 Dec 2017 18:21:51 -0800 Subject: [PATCH 1/2] Bump 2.7.0 + changelog Signed-off-by: Joffrey F --- docker/version.py | 2 +- docs/change-log.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/docker/version.py b/docker/version.py index fd822461..25021833 100644 --- a/docker/version.py +++ b/docker/version.py @@ -1,2 +1,2 @@ -version = "2.7.0-dev" +version = "2.7.0" version_info = tuple([int(d) for d in version.split("-")[0].split(".")]) diff --git a/docs/change-log.md b/docs/change-log.md index 57293f3e..b8298a79 100644 --- a/docs/change-log.md +++ b/docs/change-log.md @@ -1,6 +1,41 @@ Change log ========== +2.7.0 +----- + +[List of PRs / issues for this release](https://github.com/docker/docker-py/milestone/41?closed=1) + +### Features + +* Added `unlock_swarm` and `get_unlock_key` methods to the `APIClient`. + * Added `unlock` and `get_unlock_key` to `DockerClient.swarm`. +* Added a `greedy` parameter to `DockerClient.networks.list`, yielding + additional details about the listed networks. +* Added `cpu_rt_runtime` and `cpu_rt_period` as parameters to + `APIClient.create_host_config` and `DockerClient.containers.run`. +* Added the `order` argument to `UpdateConfig`. +* Added `fetch_current_spec` to `APIClient.update_service` and `Service.update` + that will retrieve the current configuration of the service and merge it with + the provided parameters to determine the new configuration. + +### Bugfixes + +* Fixed a bug where the `build` method tried to include inaccessible files + in the context, leading to obscure errors during the build phase + (inaccessible files inside the context now raise an `IOError` instead). +* Fixed a bug where the `build` method would try to read from FIFOs present + inside the build context, causing it to hang. +* `APIClient.stop` will no longer override the `stop_timeout` value present + in the container's configuration. +* Fixed a bug preventing removal of networks with names containing a space. +* Fixed a bug where `DockerClient.containers.run` would crash if the + `auto_remove` parameter was set to `True`. +* Changed the default value of `listen_addr` in `join_swarm` to match the + one in `init_swarm`. +* Fixed a bug where handling HTTP errors with no body would cause an unexpected + exception to be thrown while generating an `APIError` object. + 2.6.1 ----- From 598f16771ca4673886c3ea9b86fa280d77829beb Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Tue, 19 Dec 2017 13:21:56 -0800 Subject: [PATCH 2/2] Don't attempt to retrieve container's stderr if `auto_remove` was set Signed-off-by: Joffrey F --- docker/models/containers.py | 4 +++- tests/integration/models_containers_test.py | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docker/models/containers.py b/docker/models/containers.py index f16b7cd6..6ba308e4 100644 --- a/docker/models/containers.py +++ b/docker/models/containers.py @@ -737,7 +737,9 @@ class ContainerCollection(Collection): exit_status = container.wait() if exit_status != 0: - out = container.logs(stdout=False, stderr=True) + out = None + if not kwargs.get('auto_remove'): + out = container.logs(stdout=False, stderr=True) if remove: container.remove() diff --git a/tests/integration/models_containers_test.py b/tests/integration/models_containers_test.py index 7707ae26..d246189d 100644 --- a/tests/integration/models_containers_test.py +++ b/tests/integration/models_containers_test.py @@ -1,5 +1,7 @@ -import docker import tempfile + +import docker +import pytest from .base import BaseIntegrationTest, TEST_API_VERSION from ..helpers import random_name, requires_api_version @@ -114,6 +116,16 @@ class ContainerCollectionTest(BaseIntegrationTest): ) assert out == b'hello\n' + @requires_api_version('1.25') + def test_run_with_auto_remove_error(self): + client = docker.from_env(version=TEST_API_VERSION) + with pytest.raises(docker.errors.ContainerError) as e: + client.containers.run( + 'alpine', 'sh -c ">&2 echo error && exit 1"', auto_remove=True + ) + assert e.value.exit_status == 1 + assert e.value.stderr is None + def test_run_with_streamed_logs(self): client = docker.from_env(version=TEST_API_VERSION) out = client.containers.run(