Merge pull request #1230 from jzelinskie/aci-head

allow HEAD on ACI images
This commit is contained in:
Jimmy Zelinskie 2016-02-12 16:29:12 -05:00
commit 70aa7cc731
5 changed files with 11 additions and 7 deletions

View file

@ -258,7 +258,9 @@ def _repo_verb(namespace, repository, tag, verb, formatter, sign=False, checker=
if not derived.uploading:
logger.debug('Derived %s image %s exists in storage', verb, derived.uuid)
derived_layer_path = model.storage.get_layer_path(derived)
download_url = storage.get_direct_download_url(derived.locations, derived_layer_path)
is_head_request = request.method == 'HEAD'
download_url = storage.get_direct_download_url(derived.locations, derived_layer_path,
head=is_head_request)
if download_url:
logger.debug('Redirecting to download URL for derived %s image %s', verb, derived.uuid)
return redirect(download_url)
@ -359,7 +361,7 @@ def get_aci_signature(server, namespace, repository, tag, os, arch):
@anon_protect
@verbs.route('/aci/<server>/<namespace>/<repository>/<tag>/aci/<os>/<arch>/', methods=['GET'])
@verbs.route('/aci/<server>/<namespace>/<repository>/<tag>/aci/<os>/<arch>/', methods=['GET', 'HEAD'])
@process_auth
def get_aci_image(server, namespace, repository, tag, os, arch):
return _repo_verb(namespace, repository, tag, 'aci', ACIImage(),