Disable derived image storage entirely until we fix it to be by image, not storage

This commit is contained in:
Joseph Schorr 2015-11-23 23:49:46 -05:00
parent c9b1a02e9c
commit 5d3aa2a2b9

View file

@ -1,6 +1,7 @@
import logging
import json
import hashlib
import uuid
from flask import redirect, Blueprint, abort, send_file, make_response
@ -166,27 +167,26 @@ def _repo_verb(namespace, repository, tag, verb, formatter, sign=False, checker=
track_and_log('repo_verb', repo_image.repository, tag=tag, verb=verb, **kwargs)
# Lookup/create the derived image storage for the verb.
derived = model.storage.find_or_create_derived_storage(repo_image.storage, verb,
store.preferred_locations[0])
#derived = model.storage.find_or_create_derived_storage(repo_image.storage, verb,
# store.preferred_locations[0])
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 = store.get_direct_download_url(derived.locations, derived_layer_path)
if download_url:
logger.debug('Redirecting to download URL for derived %s image %s', verb, derived.uuid)
return redirect(download_url)
#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 = store.get_direct_download_url(derived.locations, derived_layer_path)
# if download_url:
# logger.debug('Redirecting to download URL for derived %s image %s', verb, derived.uuid)
# return redirect(download_url)
# Close the database handle here for this process before we send the long download.
database.close_db_filter(None)
# # Close the database handle here for this process before we send the long download.
# database.close_db_filter(None)
logger.debug('Sending cached derived %s image %s', verb, derived.uuid)
return send_file(store.stream_read_file(derived.locations, derived_layer_path))
# logger.debug('Sending cached derived %s image %s', verb, derived.uuid)
# return send_file(store.stream_read_file(derived.locations, derived_layer_path))
# Load the full image list for the image.
full_image_list = model.image.get_image_layers(repo_image)
derived_uuid = str(uuid.uuid4())
logger.debug('Building and returning derived %s image %s', verb, derived.uuid)
logger.debug('Building and returning derived %s image %s', verb, derived_uuid)
# Load the image's JSON layer.
if not image_json:
@ -207,23 +207,23 @@ def _repo_verb(namespace, repository, tag, verb, formatter, sign=False, checker=
args, finished=_cleanup)
client_queue_file = QueueFile(queue_process.create_queue(), 'client')
storage_queue_file = QueueFile(queue_process.create_queue(), 'storage')
#storage_queue_file = QueueFile(queue_process.create_queue(), 'storage')
# If signing is required, add a QueueFile for signing the image as we stream it out.
signing_queue_file = None
if sign and signer.name:
signing_queue_file = QueueFile(queue_process.create_queue(), 'signing')
#signing_queue_file = None
#if sign and signer.name:
# signing_queue_file = QueueFile(queue_process.create_queue(), 'signing')
# Start building.
queue_process.run()
# Start the storage saving.
storage_args = (verb, derived.uuid, derived.locations, storage_queue_file)
QueueProcess.run_process(_write_synthetic_image_to_storage, storage_args, finished=_cleanup)
#storage_args = (verb, derived_uuid, derived.locations, storage_queue_file)
#QueueProcess.run_process(_write_synthetic_image_to_storage, storage_args, finished=_cleanup)
if sign and signer.name:
signing_args = (verb, derived.uuid, signing_queue_file)
QueueProcess.run_process(_sign_sythentic_image, signing_args, finished=_cleanup)
#if sign and signer.name:
# signing_args = (verb, derived_uuid, signing_queue_file)
# QueueProcess.run_process(_sign_sythentic_image, signing_args, finished=_cleanup)
# Close the database handle here for this process before we send the long download.
database.close_db_filter(None)