Python oslo_config.cfg 模块,set_defaults() 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用oslo_config.cfg.set_defaults()

项目:masakari    作者:openstack    | 项目源码 | 文件源码
def set_middleware_defaults():
    """Update default configuration options for oslo.middleware."""
    # CORS Defaults
    cfg.set_defaults(cors.CORS_OPTS,
                     allow_headers=['X-Auth-Token',
                                    'X-Openstack-Request-Id',
                                    'X-Identity-Status',
                                    'X-Roles',
                                    'X-Service-Catalog',
                                    'X-User-Id',
                                    'X-Tenant-Id'],
                     expose_headers=['X-Auth-Token',
                                     'X-Openstack-Request-Id',
                                     'X-Subject-Token',
                                     'X-Service-Token'],
                     allow_methods=['GET',
                                    'PUT',
                                    'POST',
                                    'DELETE',
                                    'PATCH']
                     )
项目:Trusted-Platform-Module-nova    作者:BU-NU-CLOUD-SP16    | 项目源码 | 文件源码
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-Identity-Status',
                                    'X-Roles',
                                    'X-Service-Catalog',
                                    'X-User-Id',
                                    'X-Tenant-Id'],
                     expose_headers=['X-Auth-Token',
                                     'X-Openstack-Request-Id',
                                     'X-Subject-Token',
                                     'X-Service-Token'],
                     allow_methods=['GET',
                                    'PUT',
                                    'POST',
                                    'DELETE',
                                    'PATCH']
                     )
项目:masakari-monitors    作者:openstack    | 项目源码 | 文件源码
def set_middleware_defaults():
    """Update default configuration options for oslo.middleware."""
    # CORS Defaults
    cfg.set_defaults(cors.CORS_OPTS)
项目:gnocchi    作者:gnocchixyz    | 项目源码 | 文件源码
def set_defaults():
    from oslo_middleware import cors
    cfg.set_defaults(cors.CORS_OPTS,
                     allow_headers=[
                         'Authorization',
                         'X-Auth-Token',
                         'X-Subject-Token',
                         'X-User-Id',
                         'X-Domain-Id',
                         'X-Project-Id',
                         'X-Roles'])
项目:ranger-agent    作者:openstack    | 项目源码 | 文件源码
def prepare_service(argv=None):
    i18n.enable_lazy()
    log_levels = (cfg.CONF.default_log_levels +
                  ['stevedore=INFO'])
    cfg.set_defaults(log.log_opts,
                     default_log_levels=log_levels)
    if argv is None:
        argv = sys.argv
    cfg.CONF(argv[1:], project='ord', validate_default_values=True)
    log.setup('ord')
    # messaging.setup()
项目:ranger-agent    作者:openstack    | 项目源码 | 文件源码
def set_defaults(logging_context_format_string=None,
                 default_log_levels=None):
    # Just in case the caller is not setting the
    # default_log_level. This is insurance because
    # we introduced the default_log_level parameter
    # later in a backwards in-compatible change
    if default_log_levels is not None:
        cfg.set_defaults(
            log_opts,
            default_log_levels=default_log_levels)
    if logging_context_format_string is not None:
        cfg.set_defaults(
            log_opts,
            logging_context_format_string=logging_context_format_string)
项目:glare    作者:openstack    | 项目源码 | 文件源码
def set_glance_store_config_defaults():
    # By default glance and glare share common place to store data.
    # To prevent possible collisions we have to set other glance_store default
    # values for various backends.
    cfg.set_defaults(glance_store.backend._list_opts()[1][1],
                     # default '/var/lib/glance/images
                     filesystem_store_datadir='/var/lib/glare/artifacts',
                     # default 'images'
                     rbd_store_pool='artifacts',
                     # default '/openstack_glance
                     vmware_store_image_dir='/openstack_glare',
                     # default 'glance'
                     swift_store_container='glare')