summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2015-02-10 12:43:33 -0800
committerJoffrey F <joffrey@docker.com>2015-02-10 12:55:43 -0800
commit35c4cbd9c49d70922802aa19cb57c302c9bc9d8b (patch)
tree68bd42e906f0def9083cb500d04d4234642a2b1f
parent41a94174fd4773c12cdcdb7dad54273a3c0b2ff8 (diff)
downloaddocker-py-35c4cbd9c49d70922802aa19cb57c302c9bc9d8b.tar.gz
Bumped default API version, fixed rename()
-rw-r--r--docker/client.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/docker/client.py b/docker/client.py
index 664082e..dcfcef5 100644
--- a/docker/client.py
+++ b/docker/client.py
@@ -33,7 +33,7 @@ from .tls import TLSConfig
if not six.PY3:
import websocket
-DEFAULT_DOCKER_API_VERSION = '1.16'
+DEFAULT_DOCKER_API_VERSION = '1.17'
DEFAULT_TIMEOUT_SECONDS = 60
STREAM_HEADER_SIZE_BYTES = 8
@@ -374,8 +374,12 @@ class Client(requests.Session):
sep = bytes() if six.PY3 else str()
- return stream and self._multiplexed_response_stream_helper(response) or \
- sep.join([x for x in self._multiplexed_buffer_helper(response)])
+ if stream:
+ return self._multiplexed_response_stream_helper(response)
+ else:
+ return sep.join(
+ [x for x in self._multiplexed_buffer_helper(response)]
+ )
def attach_socket(self, container, params=None, ws=False):
if params is None:
@@ -893,11 +897,15 @@ class Client(requests.Session):
self._raise_for_status(res)
def rename(self, container, name):
+ if utils.compare_version('1.17', self._version) < 0:
+ raise errors.InvalidVersion(
+ 'rename was only introduced in API version 1.17'
+ )
if isinstance(container, dict):
container = container.get('Id')
url = self._url("/containers/{0}/rename".format(container))
params = {'name': name}
- res = self._post(url, None, params=params)
+ res = self._post(url, params=params)
self._raise_for_status(res)
def resize(self, container, height, width):