Fix the build worker to use the latest docker-py.

This commit is contained in:
jakedt 2014-03-05 10:32:24 -05:00
parent 39de79dec6
commit 270a62b8c1

View file

@ -49,6 +49,11 @@ class StatusWrapper(object):
build_logs.set_status(self._uuid, self._status) build_logs.set_status(self._uuid, self._status)
def unwrap_stream(json_stream):
for json_entry in json_stream:
yield json.loads(json_entry).values()[0]
class DockerfileBuildContext(object): class DockerfileBuildContext(object):
def __init__(self, build_context_dir, dockerfile_subdir, repo, tag_names, def __init__(self, build_context_dir, dockerfile_subdir, repo, tag_names,
push_token, build_uuid): push_token, build_uuid):
@ -57,7 +62,7 @@ class DockerfileBuildContext(object):
self._repo = repo self._repo = repo
self._tag_names = tag_names self._tag_names = tag_names
self._push_token = push_token self._push_token = push_token
self._cl = Client(timeout=1200, version='1.7') self._cl = Client(timeout=1200)
self._status = StatusWrapper(build_uuid) self._status = StatusWrapper(build_uuid)
self._build_logger = partial(build_logs.append_log_message, build_uuid) self._build_logger = partial(build_logs.append_log_message, build_uuid)
@ -109,7 +114,7 @@ class DockerfileBuildContext(object):
current_step = 0 current_step = 0
built_image = None built_image = None
for status in build_status: for status in unwrap_stream(build_status):
status_str = str(status.encode('utf-8')) status_str = str(status.encode('utf-8'))
logger.debug('Status: %s', status_str) logger.debug('Status: %s', status_str)
step_increment = re.search(r'Step ([0-9]+) :', status) step_increment = re.search(r'Step ([0-9]+) :', status)