|
33 | 33 | if not six.PY3:
|
34 | 34 | import websocket
|
35 | 35 |
|
36 |
| -DEFAULT_DOCKER_API_VERSION = '1.16' |
| 36 | +DEFAULT_DOCKER_API_VERSION = '1.17' |
37 | 37 | DEFAULT_TIMEOUT_SECONDS = 60
|
38 | 38 | STREAM_HEADER_SIZE_BYTES = 8
|
39 | 39 |
|
@@ -374,8 +374,12 @@ def stream_result():
|
374 | 374 |
|
375 | 375 | sep = bytes() if six.PY3 else str()
|
376 | 376 |
|
377 |
| - return stream and self._multiplexed_response_stream_helper(response) or \ |
378 |
| - sep.join([x for x in self._multiplexed_buffer_helper(response)]) |
| 377 | + if stream: |
| 378 | + return self._multiplexed_response_stream_helper(response) |
| 379 | + else: |
| 380 | + return sep.join( |
| 381 | + [x for x in self._multiplexed_buffer_helper(response)] |
| 382 | + ) |
379 | 383 |
|
380 | 384 | def attach_socket(self, container, params=None, ws=False):
|
381 | 385 | if params is None:
|
@@ -893,11 +897,15 @@ def remove_image(self, image, force=False, noprune=False):
|
893 | 897 | self._raise_for_status(res)
|
894 | 898 |
|
895 | 899 | def rename(self, container, name):
|
| 900 | + if utils.compare_version('1.17', self._version) < 0: |
| 901 | + raise errors.InvalidVersion( |
| 902 | + 'rename was only introduced in API version 1.17' |
| 903 | + ) |
896 | 904 | if isinstance(container, dict):
|
897 | 905 | container = container.get('Id')
|
898 | 906 | url = self._url("/containers/{0}/rename".format(container))
|
899 | 907 | params = {'name': name}
|
900 |
| - res = self._post(url, None, params=params) |
| 908 | + res = self._post(url, params=params) |
901 | 909 | self._raise_for_status(res)
|
902 | 910 |
|
903 | 911 | def resize(self, container, height, width):
|
|
0 commit comments