Fix storage indentation
This commit is contained in:
parent
dcec90649e
commit
5dfa46ed56
2 changed files with 12 additions and 8 deletions
|
@ -15,13 +15,15 @@ STORAGE_DRIVER_CLASSES = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_storage_driver(location, metric_queue, chunk_cleanup_queue, config_provider, ip_resolver, storage_params):
|
def get_storage_driver(location, metric_queue, chunk_cleanup_queue, config_provider, ip_resolver,
|
||||||
|
storage_params):
|
||||||
""" Returns a storage driver class for the given storage configuration
|
""" Returns a storage driver class for the given storage configuration
|
||||||
(a pair of string name and a dict of parameters). """
|
(a pair of string name and a dict of parameters). """
|
||||||
driver = storage_params[0]
|
driver = storage_params[0]
|
||||||
parameters = storage_params[1]
|
parameters = storage_params[1]
|
||||||
driver_class = STORAGE_DRIVER_CLASSES.get(driver, FakeStorage)
|
driver_class = STORAGE_DRIVER_CLASSES.get(driver, FakeStorage)
|
||||||
context = StorageContext(location, metric_queue, chunk_cleanup_queue, config_provider, ip_resolver)
|
context = StorageContext(location, metric_queue, chunk_cleanup_queue, config_provider,
|
||||||
|
ip_resolver)
|
||||||
return driver_class(context, **parameters)
|
return driver_class(context, **parameters)
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +46,8 @@ class Storage(object):
|
||||||
else:
|
else:
|
||||||
self.state = None
|
self.state = None
|
||||||
|
|
||||||
def init_app(self, app, metric_queue, chunk_cleanup_queue, instance_keys, config_provider, ip_resolver):
|
def init_app(self, app, metric_queue, chunk_cleanup_queue, instance_keys, config_provider,
|
||||||
|
ip_resolver):
|
||||||
storages = {}
|
storages = {}
|
||||||
for location, storage_params in app.config.get('DISTRIBUTED_STORAGE_CONFIG').items():
|
for location, storage_params in app.config.get('DISTRIBUTED_STORAGE_CONFIG').items():
|
||||||
storages[location] = get_storage_driver(location, metric_queue, chunk_cleanup_queue,
|
storages[location] = get_storage_driver(location, metric_queue, chunk_cleanup_queue,
|
||||||
|
|
|
@ -577,12 +577,13 @@ class RadosGWStorage(_CloudStorage):
|
||||||
storage_path, bucket_name, access_key, secret_key)
|
storage_path, bucket_name, access_key, secret_key)
|
||||||
|
|
||||||
# TODO remove when radosgw supports cors: http://tracker.ceph.com/issues/8718#change-38624
|
# TODO remove when radosgw supports cors: http://tracker.ceph.com/issues/8718#change-38624
|
||||||
def get_direct_download_url(self, path, request_ip=None, expires_in=60, requires_cors=False, head=False):
|
def get_direct_download_url(self, path, request_ip=None, expires_in=60, requires_cors=False,
|
||||||
|
head=False):
|
||||||
if requires_cors:
|
if requires_cors:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return super(RadosGWStorage, self).get_direct_download_url(path, request_ip, expires_in, requires_cors,
|
return super(RadosGWStorage, self).get_direct_download_url(path, request_ip, expires_in,
|
||||||
head)
|
requires_cors, head)
|
||||||
|
|
||||||
# TODO remove when radosgw supports cors: http://tracker.ceph.com/issues/8718#change-38624
|
# TODO remove when radosgw supports cors: http://tracker.ceph.com/issues/8718#change-38624
|
||||||
def get_direct_upload_url(self, path, mime_type, requires_cors=True):
|
def get_direct_upload_url(self, path, mime_type, requires_cors=True):
|
||||||
|
@ -622,8 +623,8 @@ class CloudFrontedS3Storage(S3Storage):
|
||||||
resolved_ip_info = None
|
resolved_ip_info = None
|
||||||
logger.debug('Got direct download request for path "%s" with IP "%s"', path, request_ip)
|
logger.debug('Got direct download request for path "%s" with IP "%s"', path, request_ip)
|
||||||
if request_ip is not None and self._context.ip_resolver is not None:
|
if request_ip is not None and self._context.ip_resolver is not None:
|
||||||
# Lookup the IP address in our resolution table and determine whether it is under AWS. If it is,
|
# Lookup the IP address in our resolution table and determine whether it is under AWS.
|
||||||
# then return an S3 signed URL, since we are in-network.
|
# If it is, then return an S3 signed URL, since we are in-network.
|
||||||
resolved_ip_info = self._context.ip_resolver.resolve_ip(request_ip)
|
resolved_ip_info = self._context.ip_resolver.resolve_ip(request_ip)
|
||||||
logger.debug('Resolved IP information for IP %s: %s', request_ip, resolved_ip_info)
|
logger.debug('Resolved IP information for IP %s: %s', request_ip, resolved_ip_info)
|
||||||
if resolved_ip_info and resolved_ip_info.provider == 'aws':
|
if resolved_ip_info and resolved_ip_info.provider == 'aws':
|
||||||
|
|
Reference in a new issue