config.py (zun-6.0.0) | : | config.py (zun-7.0.0) | ||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
# | # | |||
# http://www.apache.org/licenses/LICENSE-2.0 | # http://www.apache.org/licenses/LICENSE-2.0 | |||
# | # | |||
# Unless required by applicable law or agreed to in writing, software | # Unless required by applicable law or agreed to in writing, software | |||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | |||
# License for the specific language governing permissions and limitations | # License for the specific language governing permissions and limitations | |||
# under the License. | # under the License. | |||
from oslo_middleware import cors | from oslo_middleware import cors | |||
from oslo_policy import opts | ||||
from zun.common import rpc | from zun.common import rpc | |||
import zun.conf | import zun.conf | |||
from zun import version | from zun import version | |||
def init(args, **kwargs): | def init(args, **kwargs): | |||
zun.conf.CONF(args, | zun.conf.CONF(args, | |||
project='zun', | project='zun', | |||
version=version.version_info.release_string(), | version=version.version_info.release_string(), | |||
**kwargs) | **kwargs) | |||
def parse_args(argv, default_config_files=None): | def parse_args(argv, default_config_files=None): | |||
rpc.set_defaults(control_exchange='zun') | rpc.set_defaults(control_exchange='zun') | |||
init(argv[1:], default_config_files=default_config_files) | init(argv[1:], default_config_files=default_config_files) | |||
rpc.init(zun.conf.CONF) | rpc.init(zun.conf.CONF) | |||
def set_config_defaults(): | def set_config_defaults(): | |||
"""This method updates all configuration default values.""" | """This method updates all configuration default values.""" | |||
set_cors_middleware_defaults() | set_cors_middleware_defaults() | |||
# TODO(gmann): Remove setting the default value of config policy_file | ||||
# once oslo_policy change the default value to 'policy.yaml'. | ||||
# https://github.com/openstack/oslo.policy/blob/a626ad12fe5a3abd49d70e3e5b95 | ||||
589d279ab578/oslo_policy/opts.py#L49 | ||||
opts.set_defaults(zun.conf.CONF, 'policy.yaml') | ||||
def set_cors_middleware_defaults(): | def set_cors_middleware_defaults(): | |||
"""Update default configuration options for oslo.middleware.""" | """Update default configuration options for oslo.middleware.""" | |||
cors.set_defaults( | cors.set_defaults( | |||
allow_headers=['X-Auth-Token', | allow_headers=['X-Auth-Token', | |||
'X-Identity-Status', | 'X-Identity-Status', | |||
'X-Roles', | 'X-Roles', | |||
'X-Service-Catalog', | 'X-Service-Catalog', | |||
'X-User-Id', | 'X-User-Id', | |||
'X-Project-Id', | 'X-Project-Id', | |||
'X-OpenStack-Request-ID', | 'X-OpenStack-Request-ID', | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 7 lines changed or added |