Kaydet (Commit) 7722d718 authored tarafından Joffrey F's avatar Joffrey F

insert() is no longer available in API >=1.12

üst de066a1a
...@@ -30,7 +30,7 @@ from . import errors ...@@ -30,7 +30,7 @@ from . import errors
if not six.PY3: if not six.PY3:
import websocket import websocket
DEFAULT_DOCKER_API_VERSION = '1.9' DEFAULT_DOCKER_API_VERSION = '1.12'
DEFAULT_TIMEOUT_SECONDS = 60 DEFAULT_TIMEOUT_SECONDS = 60
STREAM_HEADER_SIZE_BYTES = 8 STREAM_HEADER_SIZE_BYTES = 8
...@@ -546,6 +546,10 @@ class Client(requests.Session): ...@@ -546,6 +546,10 @@ class Client(requests.Session):
True) True)
def insert(self, image, url, path): def insert(self, image, url, path):
if utils.compare_version('1.12', self._version) >= 0:
raise errors.DeprecatedMethod(
'insert is not available for API version >=1.12'
)
api_url = self._url("/images/" + image + "/insert") api_url = self._url("/images/" + image + "/insert")
params = { params = {
'url': url, 'url': url,
...@@ -611,6 +615,8 @@ class Client(requests.Session): ...@@ -611,6 +615,8 @@ class Client(requests.Session):
def logs(self, container, stdout=True, stderr=True, stream=False, def logs(self, container, stdout=True, stderr=True, stream=False,
timestamps=False): timestamps=False):
if isinstance(container, dict):
container = container.get('Id')
if utils.compare_version('1.11', self._version) >= 0: if utils.compare_version('1.11', self._version) >= 0:
params = {'stderr': stderr and 1 or 0, params = {'stderr': stderr and 1 or 0,
'stdout': stdout and 1 or 0, 'stdout': stdout and 1 or 0,
......
...@@ -59,3 +59,7 @@ class InvalidRepository(DockerException): ...@@ -59,3 +59,7 @@ class InvalidRepository(DockerException):
class InvalidConfigFile(DockerException): class InvalidConfigFile(DockerException):
pass pass
class DeprecatedMethod(DockerException):
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment