Add keystone V3 support for service credentials
Currently, service credentials don't support to specify the keystone V3 related options. This lead to alarm-evaluator service can't work well. This patch give the ability to specify os_user_domain_id, os_project_name, os_project_domain_id options to support keystone V3. Change-Id: I93dc8360de7fc04ff55661c44d4ad74be5b3de07 Closes-Bug: #1478796
This commit is contained in:
parent
f06820cf9b
commit
f98bda2cbb
@ -66,6 +66,9 @@ class ThresholdEvaluator(evaluator.Evaluator):
|
||||
os_endpoint_type=auth_config.os_endpoint_type,
|
||||
insecure=auth_config.insecure,
|
||||
timeout=cfg.CONF.http_timeout,
|
||||
os_user_domain_id=auth_config.os_user_domain_id,
|
||||
os_project_name=auth_config.os_project_name,
|
||||
os_project_domain_id=auth_config.os_project_domain_id,
|
||||
)
|
||||
self.api_client = ceiloclient.get_client(2, **creds)
|
||||
return self.api_client
|
||||
|
@ -89,6 +89,15 @@ CLI_OPTS = [
|
||||
default=False,
|
||||
help='Disables X.509 certificate validation when an '
|
||||
'SSL connection to Identity Service is established.'),
|
||||
cfg.StrOpt('os-user-domain-id',
|
||||
default=os.environ.get('OS_USER_DOMAIN_ID', 'default'),
|
||||
help='The domain id of the user'),
|
||||
cfg.StrOpt('os-project-domain-id',
|
||||
default=os.environ.get('OS_PROJECT_DOMAIN_ID', 'default'),
|
||||
help='The domain id of the user project'),
|
||||
cfg.StrOpt('os-project-name',
|
||||
default=os.environ.get('OS_PROJECT_NAME', 'admin'),
|
||||
help='The user project name'),
|
||||
]
|
||||
cfg.CONF.register_cli_opts(CLI_OPTS, group="service_credentials")
|
||||
|
||||
|
@ -421,7 +421,8 @@ class TestEvaluate(base.TestEvaluatorBase):
|
||||
self.evaluator.api_client = None
|
||||
self._evaluate_all_alarms()
|
||||
conf = self.conf.service_credentials
|
||||
expected = [mock.call(2,
|
||||
expected = [mock.call(
|
||||
2,
|
||||
os_auth_url=conf.os_auth_url,
|
||||
os_region_name=conf.os_region_name,
|
||||
os_tenant_name=conf.os_tenant_name,
|
||||
@ -430,7 +431,10 @@ class TestEvaluate(base.TestEvaluatorBase):
|
||||
os_cacert=conf.os_cacert,
|
||||
os_endpoint_type=conf.os_endpoint_type,
|
||||
timeout=self.conf.http_timeout,
|
||||
insecure=conf.insecure)]
|
||||
insecure=conf.insecure,
|
||||
os_user_domain_id=conf.os_user_domain_id,
|
||||
os_project_name=conf.os_project_name,
|
||||
os_project_domain_id=conf.os_project_domain_id)]
|
||||
actual = client.call_args_list
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user