Some small fixes to the dockerfile build worker.

This commit is contained in:
yackob03 2014-02-13 11:44:39 -05:00
parent 889d178336
commit 1e8ec634e2

View file

@ -56,7 +56,7 @@ class DockerfileBuildContext(object):
self._push_token = push_token
self._cl = Client(timeout=1200, version='1.7')
self._status = StatusWrapper(build_uuid)
self._build_logger = partial(build_logs, build_uuid)
self._build_logger = partial(build_logs.append_log_message, build_uuid)
dockerfile_path = os.path.join(self._build_dir, "Dockerfile")
self._num_steps = DockerfileBuildContext.__count_steps(dockerfile_path)
@ -101,17 +101,18 @@ class DockerfileBuildContext(object):
current_step = 0
built_image = None
for status in build_status:
logger.debug('Status: %s', str(status.encode('utf-8')))
status_str = str(status.encode('utf-8'))
logger.debug('Status: %s', status_str)
step_increment = re.search(r'Step ([0-9]+) :', status)
if step_increment:
self._build_logger(str(status), build_logs.COMMAND)
self._build_logger(status_str, build_logs.COMMAND)
current_step = int(step_increment.group(1))
logger.debug('Step now: %s/%s' % (current_step, self._num_steps))
with self._status as status:
status['current_command'] = current_step
continue
else:
self._build_logger(str(status))
self._build_logger(status_str)
complete = re.match(r'Successfully built ([a-z0-9]+)$', status)
if complete:
@ -314,7 +315,7 @@ class DockerfileBuildWorker(Worker):
logger.exception('Exception when processing request.')
repository_build.phase = 'error'
repository_build.save()
log_appender(exc.message, build_logs.ERROR)
log_appender(str(exc), build_logs.ERROR)
return False
return True