"Fossies" - the Fresh Open Source Software Archive

Member "zun-7.0.0/zun/common/config.py" (14 Apr 2021, 2545 Bytes) of package /linux/misc/openstack/zun-7.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "config.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 6.0.0_vs_7.0.0.

    1 # Copyright 2010 United States Government as represented by the
    2 # Administrator of the National Aeronautics and Space Administration.
    3 # All Rights Reserved.
    4 # Copyright 2012 Red Hat, Inc.
    5 #
    6 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
    7 #    not use this file except in compliance with the License. You may obtain
    8 #    a copy of the License at
    9 #
   10 #         http://www.apache.org/licenses/LICENSE-2.0
   11 #
   12 #    Unless required by applicable law or agreed to in writing, software
   13 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   14 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   15 #    License for the specific language governing permissions and limitations
   16 #    under the License.
   17 
   18 from oslo_middleware import cors
   19 from oslo_policy import opts
   20 
   21 from zun.common import rpc
   22 import zun.conf
   23 from zun import version
   24 
   25 
   26 def init(args, **kwargs):
   27     zun.conf.CONF(args,
   28                   project='zun',
   29                   version=version.version_info.release_string(),
   30                   **kwargs)
   31 
   32 
   33 def parse_args(argv, default_config_files=None):
   34     rpc.set_defaults(control_exchange='zun')
   35     init(argv[1:], default_config_files=default_config_files)
   36     rpc.init(zun.conf.CONF)
   37 
   38 
   39 def set_config_defaults():
   40     """This method updates all configuration default values."""
   41     set_cors_middleware_defaults()
   42 
   43     # TODO(gmann): Remove setting the default value of config policy_file
   44     # once oslo_policy change the default value to 'policy.yaml'.
   45     # https://github.com/openstack/oslo.policy/blob/a626ad12fe5a3abd49d70e3e5b95589d279ab578/oslo_policy/opts.py#L49
   46     opts.set_defaults(zun.conf.CONF, 'policy.yaml')
   47 
   48 
   49 def set_cors_middleware_defaults():
   50     """Update default configuration options for oslo.middleware."""
   51     cors.set_defaults(
   52         allow_headers=['X-Auth-Token',
   53                        'X-Identity-Status',
   54                        'X-Roles',
   55                        'X-Service-Catalog',
   56                        'X-User-Id',
   57                        'X-Project-Id',
   58                        'X-OpenStack-Request-ID',
   59                        'X-Server-Management-Url'],
   60         expose_headers=['X-Auth-Token',
   61                         'X-Subject-Token',
   62                         'X-Service-Token',
   63                         'X-OpenStack-Request-ID',
   64                         'X-Server-Management-Url'],
   65         allow_methods=['GET',
   66                        'PUT',
   67                        'POST',
   68                        'DELETE',
   69                        'PATCH'])