diff --git a/devstack/plugin.sh b/devstack/plugin.sh index a13e709dd..43e1174e5 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -18,12 +18,13 @@ function configure_tobiko { fi # See ``lib/keystone`` where these users and tenants are set up - echo_summary "Write identity service options to ${TOBIKO_CONF}" - iniset "${tobiko_conf}" identity auth_url "$(get_auth_url)" - iniset "${tobiko_conf}" identity username "${ADMIN_USERNAME:-admin}" - iniset "${tobiko_conf}" identity password "${ADMIN_PASSWORD:-secret}" - iniset "${tobiko_conf}" identity project "${ADMIN_TENANT_NAME:-admin}" - iniset "${tobiko_conf}" identity domain "${ADMIN_DOMAIN_NAME:-Default}" + echo_summary "Write Keystone service options to ${TOBIKO_CONF}" + iniset "${tobiko_conf}" keystone auth_url "$(get_keystone_auth_url)" + iniset "${tobiko_conf}" keystone username "${ADMIN_USERNAME:-admin}" + iniset "${tobiko_conf}" keystone password "${ADMIN_PASSWORD:-secret}" + iniset "${tobiko_conf}" keystone project_name "${ADMIN_TENANT_NAME:-admin}" + iniset "${tobiko_conf}" keystone user_domain_name "${ADMIN_DOMAIN_NAME:-Default}" + iniset "${tobiko_conf}" keystone project_domain_name "${ADMIN_DOMAIN_NAME:-Default}" echo_summary "Write compute service options to ${TOBIKO_CONF}" iniset "${tobiko_conf}" compute image_ref "$(get_image_ref)" @@ -40,8 +41,8 @@ function configure_tobiko { } -function get_auth_url { - echo "${KEYSTONE_SERVICE_URI_V3:-${KEYSTONE_SERVICE_URI/v2.0/}}" +function get_keystone_auth_url { + echo "${KEYSTONE_AUTH_URI_V3:-${KEYSTONE_AUTH_URI/v2.0}}" } diff --git a/tobiko/common/clients.py b/tobiko/common/clients.py index 23ee75e8e..8c538c64a 100644 --- a/tobiko/common/clients.py +++ b/tobiko/common/clients.py @@ -33,14 +33,14 @@ def get_default_credentials(api_version=None, username=None, password=None, username = (username or config.get_any_option( 'environ.OS_USERNAME', - 'tobiko.identity.username', + 'tobiko.keystone.username', 'tempest.auth.username', 'tempest.auth.admin_username') or 'admin') password = (password or config.get_any_option( 'environ.OS_PASSWORD', - 'tobiko.identity.password', + 'tobiko.keystone.password', 'tempest.auth.password', 'tempest.auth.admin_password', 'tempest.identity.admin_password')) @@ -48,21 +48,21 @@ def get_default_credentials(api_version=None, username=None, password=None, config.get_any_option( 'environ.OS_PROJECT_NAME', 'environ.OS_TENANT_NAME', - 'tobiko.identity.project_name', + 'tobiko.keystone.project_name', 'tempest.auth.project_name', 'tempest.auth.admin_project_name') or 'admin') if auth_url is None and api_version in [None, 2]: auth_url = config.get_any_option('environ.OS_AUTH_URL', - 'tobiko.identity.auth_url', + 'tobiko.keystone.auth_url', 'tempest.identity.uri') if auth_url and api_version is None: api_version = get_version_from_url(auth_url) if auth_url is None: auth_url = config.get_any_option('environ.OS_AUTH_URL', - 'tobiko.identity.auth_url', + 'tobiko.keystone.auth_url', 'tempest.identity.uri_v3') if auth_url and api_version is None: api_version = 3 @@ -81,7 +81,7 @@ def get_default_credentials(api_version=None, username=None, password=None, user_domain_name or config.get_any_option( 'environ.OS_USER_DOMAIN_NAME', - 'tobiko.identity.user_domain_name', + 'tobiko.keystone.user_domain_name', 'tempest.auth.user_domain_name', 'tempest.auth.admin_domain_name') or 'admin'), @@ -89,7 +89,7 @@ def get_default_credentials(api_version=None, username=None, password=None, project_domain_name or config.get_any_option( 'environ.OS_PROJECT_DOMAIN_NAME', - 'tobiko.identity.project_domain_name' + 'tobiko.keystone.project_domain_name' 'tempest.identity.project_domain_name', 'tempest.auth.admin_domain_name', 'tempest.identity.admin_domain_name', diff --git a/tobiko/config.py b/tobiko/config.py index 2c106cd73..cf8a909f2 100644 --- a/tobiko/config.py +++ b/tobiko/config.py @@ -24,7 +24,8 @@ import tobiko LOG = log.getLogger(__name__) -CONFIG_MODULES = ['tobiko.openstack.config'] +CONFIG_MODULES = ['tobiko.openstack.config', + 'tobiko.openstack.keystone.config'] CONFIG_DIRS = [os.getcwd(), os.path.expanduser("~/.tobiko"), diff --git a/tobiko/openstack/config.py b/tobiko/openstack/config.py index 5b448e088..009add030 100644 --- a/tobiko/openstack/config.py +++ b/tobiko/openstack/config.py @@ -18,23 +18,6 @@ from oslo_config import cfg def register_tobiko_options(conf): - conf.register_opts( - group=cfg.OptGroup('identity'), - opts=[cfg.IntOpt('api_version', - help="Identity API version"), - cfg.StrOpt('auth_url', - help="Identity service URL"), - cfg.StrOpt('username', - help="Username"), - cfg.StrOpt('password', - help="Password"), - cfg.StrOpt('project_name', - help="Project name"), - cfg.StrOpt('user_domain_name', - help="User domain name"), - cfg.StrOpt('project_domain_name', - help="Project domain name")]) - conf.register_opts( group=cfg.OptGroup('compute'), opts=[cfg.StrOpt('image_ref', diff --git a/tobiko/openstack/keystone/config.py b/tobiko/openstack/keystone/config.py new file mode 100644 index 000000000..ae9280bdb --- /dev/null +++ b/tobiko/openstack/keystone/config.py @@ -0,0 +1,43 @@ +# Copyright 2019 Red Hat +# +# 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 __future__ import absolute_import + +from oslo_config import cfg + + +def register_tobiko_options(conf): + + conf.register_opts( + group=cfg.OptGroup('keystone'), + opts=[cfg.StrOpt('auth_url', + default=None, + help="Identity service URL"), + cfg.StrOpt('username', + default=None, + help="Username"), + cfg.StrOpt('project_name', + default=None, + help="Project name"), + cfg.StrOpt('password', + default=None, + help="Password"), + cfg.IntOpt('api_version', + default=None, + help="Identity API version"), + cfg.StrOpt('user_domain_name', + default=None, + help="User domain name"), + cfg.StrOpt('project_domain_name', + default=None, + help="Project domain name")])