Get end-to-end configuration setup working, including verification (except for Github, which is in progress)

This commit is contained in:
Joseph Schorr 2015-01-07 16:20:51 -05:00
parent 825455ea6c
commit 63504c87fb
14 changed files with 611 additions and 206 deletions

View file

@ -11,6 +11,14 @@ STORAGE_DRIVER_CLASSES = {
'RadosGWStorage': RadosGWStorage,
}
def get_storage_driver(storage_params):
""" Returns a storage driver class for the given storage configuration
(a pair of string name and a dict of parameters). """
driver = storage_params[0]
parameters = storage_params[1]
driver_class = STORAGE_DRIVER_CLASSES.get(driver, FakeStorage)
return driver_class(**parameters)
class Storage(object):
def __init__(self, app=None):
@ -23,12 +31,7 @@ class Storage(object):
def init_app(self, app):
storages = {}
for location, storage_params in app.config.get('DISTRIBUTED_STORAGE_CONFIG').items():
driver = storage_params[0]
parameters = storage_params[1]
driver_class = STORAGE_DRIVER_CLASSES.get(driver, FakeStorage)
storage = driver_class(**parameters)
storages[location] = storage
storages[location] = get_storage_driver(storage_params)
preference = app.config.get('DISTRIBUTED_STORAGE_PREFERENCE', None)
if not preference: