Files
cyborg/cyborg/conf/placement.py
chenke 71df0a289d Fix the hardcoding of user role using sdk_adapter approach
1. Refer to nova's latest code, use get_sdk to create the client[1].

2. Move placement_client define from default to seperate placement file.

Note:
The new method for get nova and placement client has been tested in latest
cyborg devstack environment. And the test results are good.

Because now cyborg does not have unit tests for the common and conf directory,
unit tests related to this patch will be added in the future, but not in this patch.

Reference:
[1]. 3f019f2db3/nova/utils.py (L1013)

Change-Id: I2a335d47ee3cc24f78b4d49942f1cccd586a0dcc
2019-09-26 11:28:04 +08:00

43 lines
1.5 KiB
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from keystoneauth1 import loading as ks_loading
from oslo_config import cfg
from cyborg.conf import utils as confutils
PLACEMENT_CONF_SECTION = 'placement'
DEFAULT_SERVICE_TYPE = 'placement'
placement_group = cfg.OptGroup(
PLACEMENT_CONF_SECTION,
title='Placement Service Options',
help="Configuration options for connecting to the placement API service")
def register_opts(conf):
conf.register_group(placement_group)
confutils.register_ksa_opts(conf, placement_group, DEFAULT_SERVICE_TYPE)
def list_opts():
return {
PLACEMENT_CONF_SECTION: (
ks_loading.get_session_conf_options() +
ks_loading.get_auth_common_conf_options() +
ks_loading.get_auth_plugin_conf_options('password') +
ks_loading.get_auth_plugin_conf_options('v2password') +
ks_loading.get_auth_plugin_conf_options('v3password') +
confutils.get_ksa_adapter_opts(DEFAULT_SERVICE_TYPE))
}