The default values needed for cinder'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 cinder's default configuration parsing. This ensures
that if a value remains unset in cinder.conf, it will be set
to use sane defaults, and that an operator modifying the
configuration file will be presented with a default set of
necessary sane headers.
Depends-on: I658e54966c390b41e3b551dd9827606c2e013511
Change-Id: Ia8735d5952d7e03b6948f748afead13e6f890271
Closes-Bug:
1551836
gmr_opts.set_defaults(CONF)
CONF(sys.argv[1:], project='cinder',
version=version.version_string())
+ config.set_middleware_defaults()
logging.setup(CONF, "cinder")
LOG = logging.getLogger('cinder.all')
i18n.enable_lazy()
# Need to register global_opts
-from cinder.common import config # noqa
+from cinder.common import config
from cinder import rpc
from cinder import service
from cinder import utils
gmr_opts.set_defaults(CONF)
CONF(sys.argv[1:], project='cinder',
version=version.version_string())
+ config.set_middleware_defaults()
logging.setup(CONF, "cinder")
python_logging.captureWarnings(True)
utils.monkey_patch()
from oslo_config import cfg
from oslo_log import log as logging
+from oslo_middleware import cors
from oslo_utils import netutils
from cinder.i18n import _
]
CONF.register_opts(global_opts)
+
+
+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-Identity-Status',
+ 'X-Roles',
+ 'X-Service-Catalog',
+ 'X-User-Id',
+ 'X-Tenant-Id',
+ 'X-OpenStack-Request-ID',
+ 'X-Trace-Info',
+ 'X-Trace-HMAC',
+ 'OpenStack-API-Version'],
+ expose_headers=['X-Auth-Token',
+ 'X-Subject-Token',
+ 'X-Service-Token',
+ 'X-OpenStack-Request-ID',
+ 'OpenStack-API-Version'],
+ allow_methods=['GET',
+ 'PUT',
+ 'POST',
+ 'DELETE',
+ 'PATCH',
+ 'HEAD']
+ )
i18n.enable_lazy()
# Need to register global_opts
-from cinder.common import config # noqa
+from cinder.common import config
from cinder import rpc
from cinder import version
CONF(sys.argv[1:], project='cinder',
version=version.version_string())
logging.setup(CONF, "cinder")
+ config.set_middleware_defaults()
rpc.init(CONF)
return wsgi.Loader(CONF).load_app(name='osapi_volume')
[filter:cors]
paste.filter_factory = oslo_middleware.cors:filter_factory
oslo_config_project = cinder
-latent_allow_headers = X-Auth-Token, X-Identity-Status, X-Roles, X-Service-Catalog, X-User-Id, X-Tenant-Id, X-OpenStack-Request-ID, X-Trace-Info, X-Trace-HMAC, OpenStack-Volume-microversion
-latent_expose_headers = X-Auth-Token, X-Subject-Token, X-Service-Token, X-OpenStack-Request-ID, OpenStack-Volume-microversion
-latent_allow_methods = GET, PUT, POST, DELETE, PATCH
[filter:faultwrap]
paste.filter_factory = cinder.api.middleware.fault:FaultWrapper.factory
oslo_concurrency = oslo_concurrency.opts:list_opts
oslo.messaging = oslo_messaging.opts:list_opts
oslo.db.concurrency = oslo.db.concurrency:list_opts
+oslo.config.opts.defaults =
+ oslo.middleware = cinder.common.config:set_middleware_defaults
console_scripts =
cinder-all = cinder.cmd.all:main
cinder-api = cinder.cmd.api:main