summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey F <f.joffrey@gmail.com>2015-02-01 15:44:30 -0800
committerJoffrey F <f.joffrey@gmail.com>2015-02-01 15:44:30 -0800
commitcd006bbfaf39cdf7c123bc467ea51fbcbea18fbe (patch)
tree4f14abee6c7e273db059bc569cad83a0a288a70d
parent08ce8d0e9fee343b03d2ea29d91d9ac53784fbfa (diff)
downloaddocker-py-cd006bbfaf39cdf7c123bc467ea51fbcbea18fbe.tar.gz
Fix #466
-rw-r--r--docker/client.py10
-rw-r--r--docker/errors.py4
2 files changed, 10 insertions, 4 deletions
diff --git a/docker/client.py b/docker/client.py
index b14c142..1dd05e3 100644
--- a/docker/client.py
+++ b/docker/client.py
@@ -533,7 +533,9 @@ class Client(requests.Session):
volumes = [volumes, ]
if host_config and utils.compare_version('1.15', self._version) < 0:
- raise errors.APIError('host_config is not supported in API < 1.15')
+ raise errors.InvalidVersion(
+ 'host_config is not supported in API < 1.15'
+ )
config = self._container_config(
image, command, hostname, user, detach, stdin_open, tty, mem_limit,
@@ -563,7 +565,7 @@ class Client(requests.Session):
def execute(self, container, cmd, detach=False, stdout=True, stderr=True,
stream=False, tty=False):
if utils.compare_version('1.15', self._version) < 0:
- raise errors.APIError('Exec is not supported in API < 1.15')
+ raise errors.InvalidVersion('Exec is not supported in API < 1.15')
if isinstance(container, dict):
container = container.get('Id')
if isinstance(cmd, six.string_types):
@@ -911,11 +913,11 @@ class Client(requests.Session):
if utils.compare_version('1.10', self._version) < 0:
if dns is not None:
- raise errors.APIError(
+ raise errors.InvalidVersion(
'dns is only supported for API version >= 1.10'
)
if volumes_from is not None:
- raise errors.APIError(
+ raise errors.InvalidVersion(
'volumes_from is only supported for API version >= 1.10'
)
diff --git a/docker/errors.py b/docker/errors.py
index 749facf..69246c9 100644
--- a/docker/errors.py
+++ b/docker/errors.py
@@ -53,6 +53,10 @@ class DockerException(Exception):
pass
+class InvalidVersion(DockerException):
+ pass
+
+
class InvalidRepository(DockerException):
pass