Sometimes status messages have an extra level of wrapping for some reason.

This commit is contained in:
jakedt 2014-03-05 17:44:22 -05:00
parent 9c8de90378
commit 9a733a7320

View file

@ -115,20 +115,21 @@ class DockerfileBuildContext(object):
current_step = 0 current_step = 0
built_image = None built_image = None
for status in unwrap_stream(build_status): for status in unwrap_stream(build_status):
status_str = str(status.encode('utf-8')) fully_unwrapped = status['message'] if 'message' in status else status
status_str = str(fully_unwrapped.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_str)
if step_increment: if step_increment:
self._build_logger(status_str, build_logs.COMMAND) self._build_logger(status_str, build_logs.COMMAND)
current_step = int(step_increment.group(1)) current_step = int(step_increment.group(1))
logger.debug('Step now: %s/%s' % (current_step, self._num_steps)) logger.debug('Step now: %s/%s' % (current_step, self._num_steps))
with self._status as status: with self._status as status_update:
status['current_command'] = current_step status_update['current_command'] = current_step
continue continue
else: else:
self._build_logger(status_str) self._build_logger(status_str)
complete = re.match(r'Successfully built ([a-z0-9]+)$', status) complete = re.match(r'Successfully built ([a-z0-9]+)$', status_str)
if complete: if complete:
built_image = complete.group(1) built_image = complete.group(1)
logger.debug('Final image ID is: %s' % built_image) logger.debug('Final image ID is: %s' % built_image)