Revert local validation context, extract another util
This commit is contained in:
parent
d7ffb54333
commit
14fefea38f
6 changed files with 18 additions and 24 deletions
|
@ -102,8 +102,7 @@ class ValidatorContext(object):
|
|||
def __init__(self, config, user_password=None, http_client=None, context=None,
|
||||
url_scheme_and_hostname=None, jwt_auth_max=None, registry_title=None,
|
||||
ip_resolver=None, feature_sec_scanner=False, is_testing=False,
|
||||
uri_creator=None, config_provider=None, instance_keys=None,
|
||||
skip_localstorage_validation=False):
|
||||
uri_creator=None, config_provider=None, instance_keys=None):
|
||||
self.config = config
|
||||
self.user = get_authenticated_user()
|
||||
self.user_password = user_password
|
||||
|
@ -118,11 +117,10 @@ class ValidatorContext(object):
|
|||
self.uri_creator = uri_creator
|
||||
self.config_provider = config_provider
|
||||
self.instance_keys = instance_keys
|
||||
self.skip_localstorage_validation = skip_localstorage_validation
|
||||
|
||||
@classmethod
|
||||
def from_app(cls, app, config, user_password, ip_resolver, instance_keys, client=None,
|
||||
config_provider=None, skip_localstorage_validation=False):
|
||||
config_provider=None):
|
||||
"""
|
||||
Creates a ValidatorContext from an app config, with a given config to validate
|
||||
:param app: the Flask app to pull configuration information from
|
||||
|
@ -148,5 +146,4 @@ class ValidatorContext(object):
|
|||
is_testing=app.config.get('TESTING', False),
|
||||
uri_creator=get_blob_download_uri_getter(app.test_request_context('/'), url_scheme_and_hostname),
|
||||
config_provider=config_provider,
|
||||
instance_keys=instance_keys,
|
||||
skip_localstorage_validation=skip_localstorage_validation)
|
||||
instance_keys=instance_keys)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from storage import get_storage_driver
|
||||
from storage import get_storage_driver, TYPE_LOCAL_STORAGE
|
||||
from util.config.validators import BaseValidator, ConfigValidationException
|
||||
|
||||
|
||||
|
@ -12,7 +12,6 @@ class StorageValidator(BaseValidator):
|
|||
client = validator_context.http_client
|
||||
ip_resolver = validator_context.ip_resolver
|
||||
config_provider = validator_context.config_provider
|
||||
skip_localstorage_validation = validator_context.skip_localstorage_validation
|
||||
|
||||
replication_enabled = config.get('FEATURE_STORAGE_REPLICATION', False)
|
||||
|
||||
|
@ -21,7 +20,9 @@ class StorageValidator(BaseValidator):
|
|||
raise ConfigValidationException('Storage configuration required')
|
||||
|
||||
for name, (storage_type, driver) in providers:
|
||||
if skip_localstorage_validation and storage_type == 'LocalStorage':
|
||||
# We can skip localstorage validation, since we can't guarantee that
|
||||
# this will be the same machine Q.E. will run under
|
||||
if storage_type == TYPE_LOCAL_STORAGE:
|
||||
continue
|
||||
|
||||
try:
|
||||
|
|
Reference in a new issue