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,
|
os_endpoint_type=auth_config.os_endpoint_type,
|
||||||
insecure=auth_config.insecure,
|
insecure=auth_config.insecure,
|
||||||
timeout=cfg.CONF.http_timeout,
|
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)
|
self.api_client = ceiloclient.get_client(2, **creds)
|
||||||
return self.api_client
|
return self.api_client
|
||||||
|
@ -89,6 +89,15 @@ CLI_OPTS = [
|
|||||||
default=False,
|
default=False,
|
||||||
help='Disables X.509 certificate validation when an '
|
help='Disables X.509 certificate validation when an '
|
||||||
'SSL connection to Identity Service is established.'),
|
'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")
|
cfg.CONF.register_cli_opts(CLI_OPTS, group="service_credentials")
|
||||||
|
|
||||||
|
@ -421,16 +421,20 @@ class TestEvaluate(base.TestEvaluatorBase):
|
|||||||
self.evaluator.api_client = None
|
self.evaluator.api_client = None
|
||||||
self._evaluate_all_alarms()
|
self._evaluate_all_alarms()
|
||||||
conf = self.conf.service_credentials
|
conf = self.conf.service_credentials
|
||||||
expected = [mock.call(2,
|
expected = [mock.call(
|
||||||
os_auth_url=conf.os_auth_url,
|
2,
|
||||||
os_region_name=conf.os_region_name,
|
os_auth_url=conf.os_auth_url,
|
||||||
os_tenant_name=conf.os_tenant_name,
|
os_region_name=conf.os_region_name,
|
||||||
os_password=conf.os_password,
|
os_tenant_name=conf.os_tenant_name,
|
||||||
os_username=conf.os_username,
|
os_password=conf.os_password,
|
||||||
os_cacert=conf.os_cacert,
|
os_username=conf.os_username,
|
||||||
os_endpoint_type=conf.os_endpoint_type,
|
os_cacert=conf.os_cacert,
|
||||||
timeout=self.conf.http_timeout,
|
os_endpoint_type=conf.os_endpoint_type,
|
||||||
insecure=conf.insecure)]
|
timeout=self.conf.http_timeout,
|
||||||
|
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
|
actual = client.call_args_list
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user