Have the config setup tool automatically prepare the S3 or GCS storage with CORS config
This commit is contained in:
parent
3a3945779d
commit
53e5fc6265
3 changed files with 62 additions and 5 deletions
|
@ -15,6 +15,13 @@ from util.oauth import GoogleOAuthConfig, GithubOAuthConfig
|
|||
|
||||
SSL_FILENAMES = ['ssl.cert', 'ssl.key']
|
||||
|
||||
def get_storage_provider(config):
|
||||
parameters = config.get('DISTRIBUTED_STORAGE_CONFIG', {}).get('local', ['LocalStorage', {}])
|
||||
try:
|
||||
return get_storage_driver(parameters)
|
||||
except TypeError:
|
||||
raise Exception('Missing required storage configuration parameter(s)')
|
||||
|
||||
def validate_service_for_config(service, config):
|
||||
""" Attempts to validate the configuration for the given service. """
|
||||
if not service in _VALIDATORS:
|
||||
|
@ -57,16 +64,18 @@ def _validate_redis(config):
|
|||
|
||||
def _validate_registry_storage(config):
|
||||
""" Validates registry storage. """
|
||||
parameters = config.get('DISTRIBUTED_STORAGE_CONFIG', {}).get('local', ['LocalStorage', {}])
|
||||
try:
|
||||
driver = get_storage_driver(parameters)
|
||||
except TypeError:
|
||||
raise Exception('Missing required storage configuration parameter(s)')
|
||||
driver = get_storage_provider(config)
|
||||
|
||||
# Put and remove a temporary file.
|
||||
driver.put_content('_verify', 'testing 123')
|
||||
driver.remove('_verify')
|
||||
|
||||
# Run setup on the driver if the read/write succeeded.
|
||||
try:
|
||||
driver.setup()
|
||||
except Exception as ex:
|
||||
raise Exception('Could not prepare storage: %s' % str(ex))
|
||||
|
||||
|
||||
def _validate_mailing(config):
|
||||
""" Validates sending email. """
|
||||
|
|
Reference in a new issue