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:
Lan Qi song 2015-07-28 15:56:58 +08:00
parent f06820cf9b
commit f98bda2cbb
3 changed files with 26 additions and 10 deletions

View File

@ -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

View File

@ -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")

View File

@ -421,16 +421,20 @@ class TestEvaluate(base.TestEvaluatorBase):
self.evaluator.api_client = None
self._evaluate_all_alarms()
conf = self.conf.service_credentials
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,
os_password=conf.os_password,
os_username=conf.os_username,
os_cacert=conf.os_cacert,
os_endpoint_type=conf.os_endpoint_type,
timeout=self.conf.http_timeout,
insecure=conf.insecure)]
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,
os_password=conf.os_password,
os_username=conf.os_username,
os_cacert=conf.os_cacert,
os_endpoint_type=conf.os_endpoint_type,
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
self.assertEqual(expected, actual)