diff --git a/etc/heat/api-paste.ini b/etc/heat/api-paste.ini index 174095ac9c..5ea89b5aee 100644 --- a/etc/heat/api-paste.ini +++ b/etc/heat/api-paste.ini @@ -59,9 +59,6 @@ heat.filter_factory = heat.api.openstack:version_negotiation_filter [filter:cors] paste.filter_factory = oslo_middleware.cors:filter_factory oslo_config_project = heat -latent_allow_headers = X-Auth-Token, X-Identity-Status, X-Roles, X-Service-Catalog, X-User-Id, X-Tenant-Id, X-OpenStack-Request-ID -latent_expose_headers = X-Auth-Token, X-Subject-Token, X-Service-Token, X-OpenStack-Request-ID -latent_allow_methods = GET, PUT, POST, DELETE, PATCH [filter:faultwrap] paste.filter_factory = heat.common.wsgi:filter_factory diff --git a/heat/cmd/api.py b/heat/cmd/api.py index b5a7518142..52eddcedf0 100644 --- a/heat/cmd/api.py +++ b/heat/cmd/api.py @@ -47,6 +47,7 @@ def main(): cfg.CONF(project='heat', prog='heat-api', version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-api') + config.set_config_defaults() messaging.setup() app = config.load_paste_app() diff --git a/heat/cmd/api_cfn.py b/heat/cmd/api_cfn.py index 9594f50bcf..8089b78b81 100644 --- a/heat/cmd/api_cfn.py +++ b/heat/cmd/api_cfn.py @@ -51,6 +51,7 @@ def main(): version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-api-cfn') logging.set_defaults() + config.set_config_defaults() messaging.setup() app = config.load_paste_app() diff --git a/heat/cmd/api_cloudwatch.py b/heat/cmd/api_cloudwatch.py index dd17f52876..b68885665a 100644 --- a/heat/cmd/api_cloudwatch.py +++ b/heat/cmd/api_cloudwatch.py @@ -51,6 +51,7 @@ def main(): version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-api-cloudwatch') logging.set_defaults() + config.set_config_defaults() messaging.setup() app = config.load_paste_app() diff --git a/heat/common/config.py b/heat/common/config.py index bf9a093dd9..e4dc350430 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -17,6 +17,7 @@ import os from eventlet.green import socket from oslo_config import cfg from oslo_log import log as logging +from oslo_middleware import cors from osprofiler import opts as profiler from heat.common import exception @@ -459,3 +460,27 @@ def get_client_option(client, option): # look for the option in the generic [clients] section cfg.CONF.import_opt(option, 'heat.common.config', group='clients') return getattr(cfg.CONF.clients, option) + + +def set_config_defaults(): + """This method updates all configuration default values.""" + # 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'], + expose_headers=['X-Auth-Token', + 'X-Subject-Token', + 'X-Service-Token', + 'X-OpenStack-Request-ID'], + allow_methods=['GET', + 'PUT', + 'POST', + 'DELETE', + 'PATCH'] + ) diff --git a/heat/httpd/heat_api.py b/heat/httpd/heat_api.py index 828aa483bc..9149dd23c2 100644 --- a/heat/httpd/heat_api.py +++ b/heat/httpd/heat_api.py @@ -38,6 +38,7 @@ def init_application(): version = hversion.version_info.version_string() cfg.CONF(project='heat', prog='heat-api', version=version) logging.setup(cfg.CONF, 'heat-api') + config.set_config_defaults() messaging.setup() port = cfg.CONF.heat_api.bind_port diff --git a/heat/httpd/heat_api_cfn.py b/heat/httpd/heat_api_cfn.py index 77e2ef323c..771fa85e02 100644 --- a/heat/httpd/heat_api_cfn.py +++ b/heat/httpd/heat_api_cfn.py @@ -40,6 +40,7 @@ def init_application(): version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-api-cfn') logging.set_defaults() + config.set_config_defaults() messaging.setup() port = cfg.CONF.heat_api_cfn.bind_port diff --git a/heat/httpd/heat_api_cloudwatch.py b/heat/httpd/heat_api_cloudwatch.py index 68b2cc447a..7aa2ce8901 100644 --- a/heat/httpd/heat_api_cloudwatch.py +++ b/heat/httpd/heat_api_cloudwatch.py @@ -40,6 +40,7 @@ def init_application(): version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-api-cloudwatch') logging.set_defaults() + config.set_config_defaults() messaging.setup() port = cfg.CONF.heat_api_cloudwatch.bind_port diff --git a/setup.cfg b/setup.cfg index b482caf2a6..554c0eadc8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -53,6 +53,9 @@ oslo.config.opts = heat.api.aws.ec2token = heat.api.aws.ec2token:list_opts heat_integrationtests.common.config = heat_integrationtests.common.config:list_opts +oslo.config.opts.defaults = + heat.common.config = heat.common.config:set_config_defaults + heat.clients = barbican = heat.engine.clients.os.barbican:BarbicanClientPlugin ceilometer = heat.engine.clients.os.ceilometer:CeilometerClientPlugin