Fix keystone credentials

Using project_domain_id as project_domain_name doesn't work and prevents
users who has project_domain_id set (but not name) to use Tobiko as
they get "bad credentials error".

This change fix it by adding a separate parameter for project_domain_id.

Change-Id: I742d17b6ac869d28f13a0ac344f8dcbc13c40220
changes/69/662969/3
abregman 4 years ago committed by Federico Ressi
parent a9e05e110c
commit 7d952d2744

@ -36,6 +36,7 @@ class KeystoneCredentials(collections.namedtuple(
'domain_name',
'user_domain_name',
'project_domain_name',
'project_domain_id',
'trust_id'])):
def to_dict(self):
@ -73,6 +74,7 @@ def keystone_credentials(api_version=None,
domain_name=None,
user_domain_name=None,
project_domain_name=None,
project_domain_id=None,
trust_id=None,
cls=KeystoneCredentials):
return cls(api_version=api_version,
@ -83,6 +85,7 @@ def keystone_credentials(api_version=None,
domain_name=domain_name,
user_domain_name=user_domain_name,
project_domain_name=project_domain_name,
project_domain_id=project_domain_id,
trust_id=trust_id)
@ -128,7 +131,8 @@ class EnvironKeystoneCredentialsFixture(tobiko.SharedFixture):
config.get_env('OS_USER_DOMAIN_NAME') or
config.get_env('OS_USER_DOMAIN_ID'))
project_domain_name = (
config.get_env('OS_PROJECT_DOMAIN_NAME') or
config.get_env('OS_PROJECT_DOMAIN_NAME'))
project_domain_id = (
config.get_env('OS_PROJECT_DOMAIN_ID'))
trust_id = config.get_env('OS_TRUST_ID')
credentials = keystone_credentials(
@ -140,6 +144,7 @@ class EnvironKeystoneCredentialsFixture(tobiko.SharedFixture):
domain_name=domain_name,
user_domain_name=user_domain_name,
project_domain_name=project_domain_name,
project_domain_id=project_domain_id,
trust_id=trust_id)
try:
credentials.validate()
@ -159,7 +164,7 @@ class ConfigKeystoneCredentialsFixture(tobiko.SharedFixture):
auth_url = conf.auth_url
if not auth_url:
LOG.debug("auth_url option not defined in 'keystone' section of "
"tobiko.conf")
"tobiko.conf")
return
api_version = (conf.api_version or
@ -181,6 +186,7 @@ class ConfigKeystoneCredentialsFixture(tobiko.SharedFixture):
domain_name=conf.domain_name,
user_domain_name=conf.user_domain_name,
project_domain_name=conf.project_domain_name,
project_domain_id=conf.project_domain_id,
trust_id=conf.trust_id)
try:
credentials.validate()

@ -44,6 +44,9 @@ def register_tobiko_options(conf):
cfg.StrOpt('project_domain_name',
default=None,
help="Project domain name"),
cfg.StrOpt('project_domain_id',
default=None,
help="Project domain ID"),
cfg.StrOpt('trust_id',
default=None,
help="Trust ID for trust scoping.")])

Loading…
Cancel
Save