satisfy the pylint gods
This commit is contained in:
parent
e3a39d7bd6
commit
4f95a814c0
1 changed files with 14 additions and 12 deletions
|
@ -1,26 +1,27 @@
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from flask import make_response, request, session, Response, redirect, abort as flask_abort
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
|
from flask import make_response, request, session, Response, redirect, abort as flask_abort
|
||||||
|
|
||||||
from app import storage as store, app
|
from app import storage as store, app
|
||||||
from auth.auth import process_auth, extract_namespace_repo_from_session
|
from auth.auth import process_auth, extract_namespace_repo_from_session
|
||||||
from auth.auth_context import get_authenticated_user
|
from auth.auth_context import get_authenticated_user
|
||||||
from auth.registry_jwt_auth import get_granted_username
|
|
||||||
from digest import checksums
|
|
||||||
from util.http import abort, exact_abort
|
|
||||||
from util.registry.filelike import SocketReader
|
|
||||||
from auth.permissions import (ReadRepositoryPermission,
|
from auth.permissions import (ReadRepositoryPermission,
|
||||||
ModifyRepositoryPermission)
|
ModifyRepositoryPermission)
|
||||||
|
from auth.registry_jwt_auth import get_granted_username
|
||||||
from data import model, database
|
from data import model, database
|
||||||
from util.registry import gzipstream
|
from digest import checksums
|
||||||
from util.registry.torrent import PieceHasher
|
|
||||||
from endpoints.v1 import v1_bp
|
from endpoints.v1 import v1_bp
|
||||||
from endpoints.decorators import anon_protect
|
from endpoints.decorators import anon_protect
|
||||||
|
from util.http import abort, exact_abort
|
||||||
|
from util.registry.filelike import SocketReader
|
||||||
|
from util.registry import gzipstream
|
||||||
from util.registry.replication import queue_storage_replication
|
from util.registry.replication import queue_storage_replication
|
||||||
|
from util.registry.torrent import PieceHasher
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -38,7 +39,7 @@ def set_uploading_flag(repo_image, is_image_uploading):
|
||||||
repo_image.storage.save()
|
repo_image.storage.save()
|
||||||
|
|
||||||
|
|
||||||
def _finish_image(namespace, repository, repo_image):
|
def _finish_image(namespace, repo_image):
|
||||||
# Checksum is ok, we remove the marker
|
# Checksum is ok, we remove the marker
|
||||||
set_uploading_flag(repo_image, False)
|
set_uploading_flag(repo_image, False)
|
||||||
|
|
||||||
|
@ -176,7 +177,7 @@ def put_image_layer(namespace, repository, image_id):
|
||||||
logger.debug('Retrieving image data')
|
logger.debug('Retrieving image data')
|
||||||
uuid = repo_image.storage.uuid
|
uuid = repo_image.storage.uuid
|
||||||
json_data = repo_image.v1_json_metadata
|
json_data = repo_image.v1_json_metadata
|
||||||
except (AttributeError):
|
except AttributeError:
|
||||||
logger.exception('Exception when retrieving image data')
|
logger.exception('Exception when retrieving image data')
|
||||||
abort(404, 'Image %(image_id)s not found', issue='unknown-image', image_id=image_id)
|
abort(404, 'Image %(image_id)s not found', issue='unknown-image', image_id=image_id)
|
||||||
|
|
||||||
|
@ -235,7 +236,8 @@ def put_image_layer(namespace, repository, image_id):
|
||||||
size_info.compressed_size,
|
size_info.compressed_size,
|
||||||
size_info.uncompressed_size)
|
size_info.uncompressed_size)
|
||||||
pieces_bytes = piece_hasher.final_piece_hashes()
|
pieces_bytes = piece_hasher.final_piece_hashes()
|
||||||
model.storage.save_torrent_info(updated_storage, app.config['BITTORRENT_PIECE_SIZE'], pieces_bytes)
|
model.storage.save_torrent_info(updated_storage, app.config['BITTORRENT_PIECE_SIZE'],
|
||||||
|
pieces_bytes)
|
||||||
|
|
||||||
# Append the computed checksum.
|
# Append the computed checksum.
|
||||||
csums = []
|
csums = []
|
||||||
|
@ -266,7 +268,7 @@ def put_image_layer(namespace, repository, image_id):
|
||||||
issue='checksum-mismatch', image_id=image_id)
|
issue='checksum-mismatch', image_id=image_id)
|
||||||
|
|
||||||
# Mark the image as uploaded.
|
# Mark the image as uploaded.
|
||||||
_finish_image(namespace, repository, repo_image)
|
_finish_image(namespace, repo_image)
|
||||||
|
|
||||||
return make_response('true', 200)
|
return make_response('true', 200)
|
||||||
|
|
||||||
|
@ -330,7 +332,7 @@ def put_image_checksum(namespace, repository, image_id):
|
||||||
issue='checksum-mismatch', image_id=image_id)
|
issue='checksum-mismatch', image_id=image_id)
|
||||||
|
|
||||||
# Mark the image as uploaded.
|
# Mark the image as uploaded.
|
||||||
_finish_image(namespace, repository, repo_image)
|
_finish_image(namespace, repo_image)
|
||||||
|
|
||||||
return make_response('true', 200)
|
return make_response('true', 200)
|
||||||
|
|
||||||
|
|
Reference in a new issue