diff options
| author | Joffrey F <joffrey@docker.com> | 2018-01-31 16:39:39 -0800 |
|---|---|---|
| committer | Joffrey F <joffrey@docker.com> | 2018-01-31 16:52:26 -0800 |
| commit | 7fabcdaa4cbcf1c7905c2c2e7669a5a4ac594735 (patch) | |
| tree | 923fd6ac95208ce9dee9eadf63e879f7bef3f6d1 /docker | |
| parent | 0a86ff0bcc33209cf1c3db38f71c30192851df3a (diff) | |
| download | docker-py-wait_return.tar.gz | |
Update wait to always return a dictwait_return
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker')
| -rw-r--r-- | docker/api/container.py | 10 | ||||
| -rw-r--r-- | docker/models/containers.py | 6 | ||||
| -rw-r--r-- | docker/version.py | 2 |
3 files changed, 7 insertions, 11 deletions
diff --git a/docker/api/container.py b/docker/api/container.py index 152a08b..962d8cb 100644 --- a/docker/api/container.py +++ b/docker/api/container.py @@ -1207,8 +1207,8 @@ class ContainerApiMixin(object): or ``removed`` Returns: - (int or dict): The exit code of the container. Returns the full API - response if no ``StatusCode`` field is included. + (dict): The API's response as a Python dictionary, including + the container's exit code under the ``StatusCode`` attribute. Raises: :py:class:`requests.exceptions.ReadTimeout` @@ -1226,8 +1226,4 @@ class ContainerApiMixin(object): params['condition'] = condition res = self._post(url, timeout=timeout, params=params) - self._raise_for_status(res) - json_ = res.json() - if 'StatusCode' in json_: - return json_['StatusCode'] - return json_ + return self._result(res, True) diff --git a/docker/models/containers.py b/docker/models/containers.py index e05aa62..963fca4 100644 --- a/docker/models/containers.py +++ b/docker/models/containers.py @@ -448,8 +448,8 @@ class Container(Model): or ``removed`` Returns: - (int): The exit code of the container. Returns ``-1`` if the API - responds without a ``StatusCode`` attribute. + (dict): The API's response as a Python dictionary, including + the container's exit code under the ``StatusCode`` attribute. Raises: :py:class:`requests.exceptions.ReadTimeout` @@ -758,7 +758,7 @@ class ContainerCollection(Collection): stdout=stdout, stderr=stderr, stream=True, follow=True ) - exit_status = container.wait() + exit_status = container.wait()['StatusCode'] if exit_status != 0: out = None if not kwargs.get('auto_remove'): diff --git a/docker/version.py b/docker/version.py index 5b76748..f141747 100644 --- a/docker/version.py +++ b/docker/version.py @@ -1,2 +1,2 @@ -version = "2.8.0-dev" +version = "3.0.0" version_info = tuple([int(d) for d in version.split("-")[0].split(".")]) |
