From b0f656731cb3799bc47cf0b6f97d08db2ee1f5a9 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 10 Jan 2018 14:46:36 -0500 Subject: [PATCH] Add support for configuring CloudFront storage engine Fixes https://jira.coreos.com/browse/QS-116 --- endpoints/api/suconfig.py | 8 ++--- .../directives/config/config-setup-tool.html | 8 ++++- static/js/core-config-setup.js | 31 ++++++++++++++---- util/config/test/test_validator.py | 32 +++++++++++++++++++ util/config/validator.py | 11 +++++++ 5 files changed, 79 insertions(+), 11 deletions(-) create mode 100644 util/config/test/test_validator.py diff --git a/endpoints/api/suconfig.py b/endpoints/api/suconfig.py index c2fca2502..66f241670 100644 --- a/endpoints/api/suconfig.py +++ b/endpoints/api/suconfig.py @@ -20,7 +20,7 @@ from endpoints.api import (ApiResource, nickname, resource, internal_only, show_ from endpoints.common import common_login from util.config.configutil import add_enterprise_config_defaults from util.config.database import sync_database_with_config -from util.config.validator import validate_service_for_config, CONFIG_FILENAMES +from util.config.validator import validate_service_for_config, is_valid_config_upload_filename from util.license import decode_license, LicenseDecodeError import features @@ -319,12 +319,12 @@ class SuperUserConfigFile(ApiResource): @verify_not_prod def get(self, filename): """ Returns whether the configuration file with the given name exists. """ - if not filename in CONFIG_FILENAMES: + if not is_valid_config_upload_filename(filename): abort(404) if SuperUserPermission().can(): return { - 'exists': config_provider.volume_file_exists(filename) + 'exists': config_provider.volume_file_exists(filename) } abort(403) @@ -333,7 +333,7 @@ class SuperUserConfigFile(ApiResource): @verify_not_prod def post(self, filename): """ Updates the configuration file with the given name. """ - if not filename in CONFIG_FILENAMES: + if not is_valid_config_upload_filename(filename): abort(404) # Note: This method can be called before the configuration exists diff --git a/static/directives/config/config-setup-tool.html b/static/directives/config/config-setup-tool.html index c7ad5d71e..c67e839c6 100644 --- a/static/directives/config/config-setup-tool.html +++ b/static/directives/config/config-setup-tool.html @@ -300,6 +300,7 @@ +
@@ -327,6 +328,11 @@ ng-if="field.kind == 'bool'"> {{ field.placeholder }} +