From 3f1d394e14c828c722fea90b4047d55a68dbb62d Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 21 Feb 2017 14:13:57 -0500 Subject: [PATCH] Catch IOErrors when starting builds Fixes https://sentry.io/coreos/backend-production/issues/207144068/ --- endpoints/api/build.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/endpoints/api/build.py b/endpoints/api/build.py index ae97571eb..ca7866f85 100644 --- a/endpoints/api/build.py +++ b/endpoints/api/build.py @@ -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