Permalink
Browse files

Fix Deprecation warning from docker_py

Squashes : Passing host config parameters in start() is deprecated
  • Loading branch information...
anish committed Mar 5, 2016
1 parent d521f15 commit 3c702fcb918f491849da86a49050eef9a5008d83
Showing with 10 additions and 4 deletions.
  1. +4 −1 master/buildbot/test/fake/docker.py
  2. +6 −3 master/buildbot/worker/docker.py
@@ -22,7 +22,7 @@ def __init__(self, base_url):
def images(self):
return self._images
def start(self, *args, **kwargs):
def start(self, container):
pass
def stop(self, id):
@@ -42,6 +42,9 @@ def build(self, fileobj, tag):
yield line
self._images.append({'RepoTags': [tag + ':latest']})
def create_host_config(self, *args, **kwargs):
pass
def create_container(self, image, *args, **kwargs):
return {'Id': '8a61192da2b3bb2d922875585e29b74ec0dc4e0117fcbf84c962204e97564cd7',
'Warnings': None}
@@ -64,7 +64,7 @@ def __init__(self, name, password, docker_host, image=None, command=None,
**kwargs):
if not client:
config.error("The python module 'docker-py' is needed to use a"
config.error("The python module 'docker-py>=1.4' is needed to use a"
" DockerLatentWorker")
if not image and not dockerfile:
config.error("DockerLatentWorker: You need to specify at least"
@@ -156,12 +156,15 @@ def _thd_start_instance(self, image):
'Image "%s" not found on docker host.' % image
)
host_conf = docker_client.create_host_config(binds=self.binds)
instance = docker_client.create_container(
image,
self.command,
name='%s_%s' % (self.workername, id(self)),
volumes=self.volumes,
environment=self.createEnvironment()
environment=self.createEnvironment(),
host_config=host_conf
)
if instance.get('Id') is None:
@@ -173,7 +176,7 @@ def _thd_start_instance(self, image):
log.msg('Container created, Id: %s...' % (shortid,))
instance['image'] = image
self.instance = instance
docker_client.start(instance, binds=self.binds)
docker_client.start(instance)
log.msg('Container started')
if self.followStartupLogs:
logs = docker_client.attach(container=instance, stdout=True, stderr=True, stream=True)

0 comments on commit 3c702fc

Please sign in to comment.