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

This commit is contained in:
Jenkins 2016-03-07 20:32:44 +00:00 committed by Gerrit Code Review
commit 3a7c796296
5 changed files with 35 additions and 4 deletions

View File

@ -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

View File

@ -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")

View File

@ -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']
)

View File

@ -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:

View File

@ -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