Merge "Moved CORS middleware configuration into oslo-config-generator"

This commit is contained in:
Jenkins 2016-03-07 08:43:25 +00:00 committed by Gerrit Code Review
commit d9463371a3
6 changed files with 41 additions and 7 deletions

0
aodh/conf/__init__.py Normal file
View File

35
aodh/conf/defaults.py Normal file
View File

@ -0,0 +1,35 @@
# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from oslo_middleware import cors
def set_cors_middleware_defaults():
"""Update default configuration options for oslo.middleware."""
# CORS Defaults
# TODO(krotscheck): Update with https://review.openstack.org/#/c/285368/
cfg.set_defaults(cors.CORS_OPTS,
allow_headers=['X-Auth-Token',
'X-Openstack-Request-Id',
'X-Subject-Token'],
expose_headers=['X-Auth-Token',
'X-Openstack-Request-Id',
'X-Subject-Token'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH']
)

View File

@ -22,6 +22,7 @@ import oslo_i18n
from oslo_log import log
from oslo_policy import opts as policy_opts
from aodh.conf import defaults
from aodh import keystone_client
from aodh import messaging
@ -54,6 +55,7 @@ def prepare_service(argv=None, config_files=None):
log_levels = (conf.default_log_levels +
['stevedore=INFO', 'keystoneclient=INFO'])
log.set_defaults(default_log_levels=log_levels)
defaults.set_cors_middleware_defaults()
db_options.set_defaults(conf)
policy_opts.set_defaults(conf)
from aodh import opts

View File

@ -19,6 +19,3 @@ paste.filter_factory = oslo_middleware:RequestId.factory
[filter:cors]
paste.filter_factory = oslo_middleware.cors:filter_factory
oslo_config_project = aodh
latent_allow_headers = X-Auth-Token, X-Openstack-Request-Id, X-Subject-Token
latent_expose_headers = X-Auth-Token, X-Openstack-Request-Id, X-Subject-Token
latent_allow_methods = GET, PUT, POST, DELETE, PATCH

View File

@ -19,7 +19,4 @@ paste.filter_factory = oslo_middleware:RequestId.factory
[filter:cors]
paste.filter_factory = oslo_middleware.cors:filter_factory
oslo_config_project = aodh
latent_allow_headers = X-Auth-Token, X-Openstack-Request-Id, X-Subject-Token
latent_expose_headers = X-Auth-Token, X-Openstack-Request-Id, X-Subject-Token
latent_allow_methods = GET, PUT, POST, DELETE, PATCH
oslo_config_project = aodh

View File

@ -114,6 +114,9 @@ oslo.config.opts =
aodh = aodh.opts:list_opts
aodh-auth = aodh.opts:list_keystoneauth_opts
oslo.config.opts.defaults =
oslo.middleware.cors = aodh.conf.defaults:set_cors_middleware_defaults
keystoneauth1.plugin =
password-aodh-legacy = aodh.keystone_client:LegacyAodhKeystoneLoader