Added Keystone and RequestID headers to CORS middleware
This patch makes use of oslo.config's genconfig hooks to add nova-specific default config values to the generated configuration. It also adds this same method to nova's configuration parsing logic, to ensure that these default values are also the ones used at runtime. Closes-bug: 1551836 Change-Id: Ic799aea89f681ef8626e996f0357ade388f76ca9
This commit is contained in:
parent
3087672083
commit
61e581c7d8
0
nova/common/__init__.py
Normal file
0
nova/common/__init__.py
Normal file
40
nova/common/config.py
Normal file
40
nova/common/config.py
Normal file
@ -0,0 +1,40 @@
|
||||
# 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_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-Identity-Status',
|
||||
'X-Roles',
|
||||
'X-Service-Catalog',
|
||||
'X-User-Id',
|
||||
'X-Tenant-Id'],
|
||||
expose_headers=['X-Auth-Token',
|
||||
'X-Openstack-Request-Id',
|
||||
'X-Subject-Token',
|
||||
'X-Service-Token'],
|
||||
allow_methods=['GET',
|
||||
'PUT',
|
||||
'POST',
|
||||
'DELETE',
|
||||
'PATCH']
|
||||
)
|
@ -20,13 +20,13 @@ from oslo_config import cfg
|
||||
from oslo_db import options
|
||||
from oslo_log import log
|
||||
|
||||
from nova.common import config
|
||||
from nova.db.sqlalchemy import api as sqlalchemy_api
|
||||
from nova import debugger
|
||||
from nova import paths
|
||||
from nova import rpc
|
||||
from nova import version
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
_DEFAULT_SQL_CONNECTION = 'sqlite:///' + paths.state_path_def('nova.sqlite')
|
||||
@ -57,6 +57,8 @@ def parse_args(argv, default_config_files=None, configure_db=True,
|
||||
rpc.set_defaults(control_exchange='nova')
|
||||
cache.configure(CONF)
|
||||
debugger.register_cli_opts()
|
||||
config.set_middleware_defaults()
|
||||
|
||||
CONF(argv[1:],
|
||||
project='nova',
|
||||
version=version.version_string(),
|
||||
|
@ -36,6 +36,9 @@ oslo.config.opts =
|
||||
nova.virt = nova.virt.opts:list_opts
|
||||
nova.cache_utils = nova.cache_utils:list_opts
|
||||
|
||||
oslo.config.opts.defaults =
|
||||
oslo.middleware = nova.common.config:set_middleware_defaults
|
||||
|
||||
nova.compute.monitors.cpu =
|
||||
virt_driver = nova.compute.monitors.cpu.virt_driver:Monitor
|
||||
nova.compute.resources =
|
||||
|
Loading…
Reference in New Issue
Block a user