def prepare_service(conf=None):
if conf is None:
conf = cfg.ConfigOpts()
opts.set_defaults()
policy_opts.set_defaults(conf)
conf = service.prepare_service(conf=conf)
cfg_path = conf.oslo_policy.policy_file
if not os.path.isabs(cfg_path):
cfg_path = conf.find_file(cfg_path)
if cfg_path is None or not os.path.exists(cfg_path):
cfg_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', 'rest', 'policy.json'))
conf.set_default('policy_file', cfg_path, group='oslo_policy')
return conf
评论列表
文章目录