From ff7f78e990b9ee1924e3578da0f74dc1fc983894 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 27 Feb 2017 13:32:09 -0500 Subject: [PATCH] Have blob uploads be checked against configurable max layer size --- ...e68ad3e52_change_blobupload_fields_to_bigintegers_.py | 9 ++------- endpoints/v2/errors.py | 5 ----- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/data/migrations/versions/b8ae68ad3e52_change_blobupload_fields_to_bigintegers_.py b/data/migrations/versions/b8ae68ad3e52_change_blobupload_fields_to_bigintegers_.py index 544e34b50..90a5b8978 100644 --- a/data/migrations/versions/b8ae68ad3e52_change_blobupload_fields_to_bigintegers_.py +++ b/data/migrations/versions/b8ae68ad3e52_change_blobupload_fields_to_bigintegers_.py @@ -1,25 +1,20 @@ """Change BlobUpload fields to BigIntegers to allow layers > 8GB Revision ID: b8ae68ad3e52 -Revises: e2894a3a3c19 +Revises: 7a525c68eb13 Create Date: 2017-02-27 11:26:49.182349 """ # revision identifiers, used by Alembic. revision = 'b8ae68ad3e52' -down_revision = 'e2894a3a3c19' +down_revision = '7a525c68eb13' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql def upgrade(tables): - # Delete old entries in the blobupload table. This is generally a good idea for cleanup and - # also makes the alter column calls much faster. - conn = op.get_bind() - conn.execute("Delete from blobupload where created <= '2017-02-01'", ()) - op.alter_column('blobupload', 'byte_count', existing_type=sa.Integer(), type_=sa.BigInteger()) op.alter_column('blobupload', 'uncompressed_byte_count', existing_type=sa.Integer(), type_=sa.BigInteger()) diff --git a/endpoints/v2/errors.py b/endpoints/v2/errors.py index 060c811a1..e511c0500 100644 --- a/endpoints/v2/errors.py +++ b/endpoints/v2/errors.py @@ -130,11 +130,6 @@ class LayerTooLarge(V2RegistryException): max_str = bitmath.Byte(max_allowed).best_prefix().format("{value:.2f} {unit}") message = 'Uploaded blob of %s is larger than %s allowed by this registry' % (up_str, max_str) - super(LayerTooLarge, self).__init__('BLOB_UPLOAD_INVALID', - message, - detail) - - class Unauthorized(V2RegistryException): def __init__(self, detail=None, repository=None, scopes=None): super(Unauthorized, self).__init__('UNAUTHORIZED',