我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用oslo_config.cfg.set_defaults()。
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'] )
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'] )
def set_middleware_defaults(): """Update default configuration options for oslo.middleware.""" # CORS Defaults cfg.set_defaults(cors.CORS_OPTS)
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'])
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()
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)
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')