Merge "Use register_session_conf_options API"

This commit is contained in:
Zuul 2018-07-24 08:50:20 +00:00 committed by Gerrit Code Review
commit 8806b5b7d8
4 changed files with 34 additions and 5 deletions

View File

@ -56,6 +56,8 @@ CONF = cfg.CONF
SERVER_THREAD_MANAGER = None
SERVER_PROCESS_MANAGER = None
LOG = logging.getLogger(__name__)
def launch_thread(server, workers=1):
try:
@ -176,12 +178,28 @@ def get_properly_ordered_parameters():
return args
def override_keystone_options():
# TODO(wxy): This function is used for keeping backward compatibility.
# Remove it in Stein.
auth_opts = CONF['keystone_authtoken']
for opt, value in auth_opts.items():
if opt in CONF['keystone']:
default_value = auth_opts._group._opts[opt]['opt'].default
if default_value != value != CONF['keystone'][opt]:
LOG.warning("The config option '%s' in section "
"[keystone_authtoken] has the same copy in "
"[keystone]. Please add the same option to the "
"[keystone] section to keep using it.", opt)
CONF.set_override(opt, value, group='keystone')
def main():
try:
config.parse_args(get_properly_ordered_parameters())
print_server_info()
logging.setup(CONF, 'Mistral')
override_keystone_options()
# Please refer to the oslo.messaging documentation for transport
# configuration. The default transport for oslo.messaging is

View File

@ -21,6 +21,7 @@ Configuration options registration and useful routines.
import itertools
import os
from keystoneauth1 import loading
from oslo_config import cfg
from oslo_log import log
from oslo_middleware import cors
@ -560,6 +561,7 @@ PROFILER_GROUP = profiler.list_opts()[0][0]
KEYCLOAK_OIDC_GROUP = "keycloak_oidc"
OPENSTACK_ACTIONS_GROUP = 'openstack_actions'
YAQL_GROUP = "yaql"
KEYSTONE_GROUP = "keystone"
CONF.register_opt(wf_trace_log_name_opt)
@ -591,6 +593,7 @@ CONF.register_opts(profiler_opts, group=PROFILER_GROUP)
CONF.register_opts(keycloak_oidc_opts, group=KEYCLOAK_OIDC_GROUP)
CONF.register_opts(openstack_actions_opts, group=OPENSTACK_ACTIONS_GROUP)
CONF.register_opts(yaql_opts, group=YAQL_GROUP)
loading.register_session_conf_options(CONF, KEYSTONE_GROUP)
CLI_OPTS = [
use_debugger_opt,

View File

@ -28,9 +28,6 @@ from mistral import context
from mistral import exceptions
CONF = cfg.CONF
CONF.register_opt(cfg.IntOpt('timeout'), group='keystone_authtoken')
CONF.register_opt(cfg.BoolOpt('collect_timing'), group='keystone_authtoken')
CONF.register_opt(cfg.BoolOpt('split_loggers'), group='keystone_authtoken')
def client():
@ -136,7 +133,7 @@ def _admin_client(trust_id=None):
)
sess = loading.load_session_from_conf_options(
CONF,
'keystone_authtoken',
'keystone',
auth=auth
)
@ -292,7 +289,7 @@ def get_admin_session():
return loading.load_session_from_conf_options(
CONF,
'keystone_authtoken',
'keystone',
auth=auth
)

View File

@ -0,0 +1,11 @@
---
fixes:
- |
A new config option section `[keystone]` is added. The options in the
section is from keystoneauth by default. Please use them to talk with
keystone session. If the option value is not set, to keep backward
compatibility, Mistral will read the value from the same option in
`[keystone_authtoken]`.
The override behvaior will be removed in Stein. Please update the options
into `[keystone]` if you still want to use them.