Catch IOErrors when starting builds

Fixes https://sentry.io/coreos/backend-production/issues/207144068/
This commit is contained in:
Joseph Schorr 2017-02-21 14:13:57 -05:00
parent d29d2da1ca
commit 3f1d394e14

View file

@ -276,9 +276,12 @@ class RepositoryBuildList(RepositoryParamResource):
if repo is None:
raise NotFound()
build_name = (user_files.get_file_checksum(dockerfile_id)
if dockerfile_id
else hashlib.sha224(archive_url).hexdigest()[0:7])
try:
build_name = (user_files.get_file_checksum(dockerfile_id)
if dockerfile_id
else hashlib.sha224(archive_url).hexdigest()[0:7])
except IOError:
raise InvalidRequest('File %s could not be found or is invalid' % dockerfile_id)
prepared = PreparedBuild()
prepared.build_name = build_name