Merge pull request #2511 from jakedt/fixwarnings

Fixwarnings
This commit is contained in:
Jake Moshenko 2017-04-06 16:12:20 -04:00 committed by GitHub
commit a8ec7865a7
11 changed files with 106 additions and 86 deletions

View file

@ -7,7 +7,7 @@ from endpoints.exception import NotFound, ApiErrorType, ERROR_DESCRIPTION
def error_view(error_type):
return {
'type': url_for('error', error_type=error_type, _external=True),
'type': url_for('api.error', error_type=error_type, _external=True),
'title': error_type,
'description': ERROR_DESCRIPTION[error_type]
}

View file

@ -71,7 +71,7 @@ class ApiException(Exception):
rv['error_type'] = self.error_type.value # TODO: deprecate
rv['title'] = self.error_type.value
rv['type'] = url_for('error', error_type=self.error_type.value, _external=True)
rv['type'] = url_for('api.error', error_type=self.error_type.value, _external=True)
rv['status'] = self.status_code
return rv

View file

@ -18,6 +18,7 @@ from endpoints.v2.blob import BLOB_DIGEST_ROUTE
from image.appc import AppCImageFormatter
from image.docker.squashed import SquashedDockerImageFormatter
from storage import Storage
from util.http import exact_abort
from util.registry.filelike import wrap_with_handler
from util.registry.queuefile import QueueFile
from util.registry.queueprocess import QueueProcess
@ -31,6 +32,9 @@ verbs = Blueprint('verbs', __name__)
license_validator.enforce_license_before_request(verbs)
LAYER_MIMETYPE = 'binary/octet-stream'
def _open_stream(formatter, repo_image, tag, derived_image_id, handlers):
"""
This method generates a stream of data which will be replicated and read from the queue files.
@ -119,7 +123,7 @@ def _torrent_for_blob(blob, is_public):
expires_in=app.config['BITTORRENT_WEBSEED_LIFETIME'])
if webseed is None:
# We cannot support webseeds for storages that cannot provide direct downloads.
abort(make_response('Storage engine does not support seeding.', 501))
exact_abort(501, 'Storage engine does not support seeding.')
# Build the filename for the torrent.
if is_public:
@ -242,7 +246,8 @@ def _repo_verb(namespace, repository, tag, verb, formatter, sign=False, checker=
database.close_db_filter(None)
logger.debug('Sending cached derived %s image %s', verb, derived_image.ref)
return send_file(storage.stream_read_file(derived_image.blob.locations, derived_layer_path))
return send_file(storage.stream_read_file(derived_image.blob.locations, derived_layer_path),
mimetype=LAYER_MIMETYPE)
logger.debug('Building and returning derived %s image %s', verb, derived_image.ref)
@ -292,7 +297,7 @@ def _repo_verb(namespace, repository, tag, verb, formatter, sign=False, checker=
database.close_db_filter(None)
# Return the client's data.
return send_file(client_queue_file)
return send_file(client_queue_file, mimetype=LAYER_MIMETYPE)
def os_arch_checker(os, arch):

View file

@ -38,6 +38,9 @@ from util.systemlogs import build_logs_archive
from util.useremails import send_email_changed
PGP_KEY_MIMETYPE = 'application/pgp-keys'
@lru_cache(maxsize=1)
def _get_route_data():
return swagger_route_data(include_internal=True, compact=True)
@ -92,7 +95,7 @@ def aci_signing_key():
if not signer.name:
abort(404)
return send_file(signer.open_public_key_file())
return send_file(signer.open_public_key_file(), mimetype=PGP_KEY_MIMETYPE)
@web.route('/plans/')
@no_cache