diff options
author | Joffrey F <joffrey@docker.com> | 2015-05-20 14:58:47 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2015-05-20 14:58:47 -0700 |
commit | abbbbfb2d6a1294238919aa115631416175f1dde (patch) | |
tree | 000c1ad69f091d1f22c2478e9c7d868fe78e2f38 | |
parent | e1f93d95c91e1e1f8735d93a15ad380f45f4dc33 (diff) | |
download | docker-py-abbbbfb2d6a1294238919aa115631416175f1dde.tar.gz |
Only allow privileged exec_create for API version >= 1.19
-rw-r--r-- | docker/client.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/docker/client.py b/docker/client.py index 022a327..b664806 100644 --- a/docker/client.py +++ b/docker/client.py @@ -531,10 +531,14 @@ class Client(requests.Session): return self.exec_start(create_res, detach, tty, stream) - def exec_create(self, container, cmd, stdout=True, - stderr=True, tty=False, privileged=False): + def exec_create(self, container, cmd, stdout=True, stderr=True, tty=False, + privileged=False): if utils.compare_version('1.15', self._version) < 0: raise errors.InvalidVersion('Exec is not supported in API < 1.15') + if privileged and utils.compare_version('1.19', self._version) < 0: + raise errors.InvalidVersion( + 'Privileged exec is not supported in API < 1.19' + ) if isinstance(container, dict): container = container.get('Id') if isinstance(cmd, six.string_types): |