Moved CORS middleware configuration into oslo-config-generator
The default values needed for manila's implementation of cors middleware have been moved from paste.ini into the configuration hooks provided by oslo.config. Furthermore, these values have been added to the default initialization procedure. This ensures that if a value remains unset in the configuration file, it will fallback to using sane defaults. It also ensures that an operator modifying the configuration will be presented with that same set of defaults. Change-Id: Ie4adc39866a4ee6132eab6a111660218b3e6e5bd Closes-Bug: #1551836
This commit is contained in:
parent
30561d5c38
commit
75d85aab3c
@ -57,6 +57,3 @@ paste.filter_factory = keystonemiddleware.auth_token:filter_factory
|
||||
[filter:cors]
|
||||
paste.filter_factory = oslo_middleware.cors:filter_factory
|
||||
oslo_config_project = manila
|
||||
latent_allow_headers = X-Auth-Token, X-OpenStack-Request-ID, X-Openstack-Manila-Api-Version, X-OpenStack-Manila-API-Experimental, X-Identity-Status, X-Roles, X-Service-Catalog, X-User-Id, X-Tenant-Id
|
||||
latent_expose_headers = X-Auth-Token, X-OpenStack-Request-ID, X-Openstack-Manila-Api-Version, X-OpenStack-Manila-API-Experimental, X-Subject-Token, X-Service-Token
|
||||
latent_allow_methods = GET, PUT, POST, DELETE, PATCH
|
||||
|
@ -37,7 +37,7 @@ from oslo_log import log
|
||||
from manila import i18n
|
||||
i18n.enable_lazy()
|
||||
|
||||
from manila.common import config # Need to register global_opts # noqa
|
||||
from manila.common import config # Need to register global_opts
|
||||
from manila.i18n import _LE
|
||||
from manila import service
|
||||
from manila import utils
|
||||
@ -48,6 +48,7 @@ CONF = cfg.CONF
|
||||
|
||||
def main():
|
||||
log.register_options(CONF)
|
||||
config.set_middleware_defaults()
|
||||
CONF(sys.argv[1:], project='manila',
|
||||
version=version.version_string())
|
||||
log.setup(CONF, "manila")
|
||||
|
@ -28,6 +28,7 @@ import socket
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_middleware import cors
|
||||
from oslo_utils import netutils
|
||||
import six
|
||||
|
||||
@ -188,3 +189,31 @@ def verify_share_protocols():
|
||||
# because of 'lazy' translations.
|
||||
msg = six.text_type(_(msg) % data) # noqa H701
|
||||
raise exception.ManilaException(message=msg)
|
||||
|
||||
|
||||
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-Openstack-Manila-Api-Version',
|
||||
'X-OpenStack-Manila-API-Experimental',
|
||||
'X-Identity-Status',
|
||||
'X-Roles',
|
||||
'X-Service-Catalog',
|
||||
'X-User-Id',
|
||||
'X-Tenant-Id'],
|
||||
expose_headers=['X-Auth-Token',
|
||||
'X-OpenStack-Request-ID',
|
||||
'X-Openstack-Manila-Api-Version',
|
||||
'X-OpenStack-Manila-API-Experimental',
|
||||
'X-Subject-Token',
|
||||
'X-Service-Token'],
|
||||
allow_methods=['GET',
|
||||
'PUT',
|
||||
'POST',
|
||||
'DELETE',
|
||||
'PATCH']
|
||||
)
|
||||
|
@ -38,6 +38,7 @@ import routes.middleware
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
from manila.common import config
|
||||
from manila import exception
|
||||
from manila.i18n import _
|
||||
from manila.i18n import _LE
|
||||
@ -198,6 +199,7 @@ class Server(service.ServiceBase):
|
||||
# give bad file descriptor error. So duplicating the socket object,
|
||||
# to keep file descriptor usable.
|
||||
|
||||
config.set_middleware_defaults()
|
||||
dup_socket = self._socket.dup()
|
||||
if self._use_ssl:
|
||||
try:
|
||||
|
@ -54,6 +54,8 @@ oslo_messaging.notify.drivers =
|
||||
manila.openstack.common.notifier.test_notifier = oslo_messaging.notify._impl_test:TestDriver
|
||||
oslo.config.opts =
|
||||
manila = manila.opts:list_opts
|
||||
oslo.config.opts.defaults =
|
||||
oslo.middleware = manila.common.config:set_middleware_defaults
|
||||
manila.share.drivers.emc.plugins =
|
||||
vnx = manila.share.drivers.emc.plugins.vnx.connection:VNXStorageConnection
|
||||
isilon = manila.share.drivers.emc.plugins.isilon.isilon:IsilonStorageConnection
|
||||
|
Loading…
Reference in New Issue
Block a user