Permalink
Browse files

Support docker-py > 1.10.6

  • Loading branch information...
anish committed Mar 27, 2017
1 parent 369ea01 commit b08a30021441af0a302090f94d4d46af5c64f717
Showing with 11 additions and 2 deletions.
  1. +3 −0 master/buildbot/test/fake/docker.py
  2. +8 −2 master/buildbot/worker/docker.py
@@ -82,3 +82,6 @@ def create_container(self, image, *args, **kwargs):
def remove_container(self, id, **kwargs):
del self._containers[id]
class APIClient(Client):
pass
@@ -201,7 +201,10 @@ def _image_exists(self, client, name):
return False
def _thd_start_instance(self, image, dockerfile, volumes):
docker_client = client.Client(**self.client_args)
if docker.version[0] == '1':
docker_client = client.Client(**self.client_args)
else:
docker_client = client.APIClient(**self.client_args)
# cleanup the old instances
instances = docker_client.containers(
all=1,
@@ -277,7 +280,10 @@ def stop_instance(self, fast=False):
return threads.deferToThread(self._thd_stop_instance, instance, fast)
def _thd_stop_instance(self, instance, fast):
docker_client = client.Client(**self.client_args)
if docker.version[0] == '1':
docker_client = client.Client(**self.client_args)
else:
docker_client = client.APIClient(**self.client_args)
log.msg('Stopping container %s...' % instance['Id'][:6])
docker_client.stop(instance['Id'])
if not fast:

0 comments on commit b08a300

Please sign in to comment.