From 4566d76e45c82f9fec45ccaccfd64ef0083f4292 Mon Sep 17 00:00:00 2001 From: jakedt Date: Thu, 6 Mar 2014 23:40:21 -0500 Subject: [PATCH] Add a mime type for x-zip-compressed. Report unknown mime types as errors. --- workers/dockerfilebuild.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/workers/dockerfilebuild.py b/workers/dockerfilebuild.py index 1cf1c2170..1a3625940 100644 --- a/workers/dockerfilebuild.py +++ b/workers/dockerfilebuild.py @@ -248,6 +248,7 @@ class DockerfileBuildWorker(Worker): self._mime_processors = { 'application/zip': DockerfileBuildWorker.__prepare_zip, + 'application/x-zip-compressed': DockerfileBuildWorker.__prepare_zip, 'text/plain': DockerfileBuildWorker.__prepare_dockerfile, 'application/octet-stream': DockerfileBuildWorker.__prepare_dockerfile, } @@ -305,7 +306,11 @@ class DockerfileBuildWorker(Worker): log_appender(filetype_msg) if c_type not in self._mime_processors: - raise RuntimeError('Invalid dockerfile content type: %s' % c_type) + log_appender('error', build_logs.PHASE) + repository_build.phase = 'error' + repository_build.save() + log_appender('Unknown mime-type: %s' % c_type, build_logs.ERROR) + return True build_dir = self._mime_processors[c_type](docker_resource) log_appender('building', build_logs.PHASE)