Made Domain name/id configuratble, not hardcoded
Domain name/id was hardcoded, always Default/default.
Now it is configurable: in the reclass on cluster level
in runtest.yml you can set keystone:client:os_client_config:
cfgs:root:content:clouds:admin_identity:auth:
project_domain_name/user_domain_name pillar to set some
specific domain. By default, the Default domain is used.
Change-Id: Id82b9d4f108fef6cd2ddced9241e907441f2d36c
Related-PROD: PROD-28480
diff --git a/_modules/runtest/tempest_sections/auth.py b/_modules/runtest/tempest_sections/auth.py
index 7f37e22..0803984 100644
--- a/_modules/runtest/tempest_sections/auth.py
+++ b/_modules/runtest/tempest_sections/auth.py
@@ -20,7 +20,10 @@
@property
def admin_domain_name(self):
- return 'Default'
+ c = conditions.BaseRule('runtest.tempest.enabled', 'eq', True)
+ return self.get_item_when_condition_match(
+ 'keystone.client.os_client_config.cfgs.root.content.'
+ 'clouds.admin_identity.auth.project_domain_name', c)
@property
def admin_password(self):
@@ -46,7 +49,7 @@
@property
def default_credentials_domain_name(self):
- pass
+ return self.admin_domain_name
@property
def tempest_roles(self):
diff --git a/_modules/runtest/tempest_sections/heat_plugin.py b/_modules/runtest/tempest_sections/heat_plugin.py
index 3a34d04..43dbf05 100644
--- a/_modules/runtest/tempest_sections/heat_plugin.py
+++ b/_modules/runtest/tempest_sections/heat_plugin.py
@@ -2,6 +2,7 @@
import base_section
from runtest import conditions
+from runtest.tempest_sections.identity import Identity
DEFAULT_HEAT_PLUGIN_PARAMETERS = {
@@ -218,11 +219,15 @@
@property
def project_domain_id(self):
- pass
+ identity = Identity(self.pillar, self.runtest_opts)
+ return identity.default_domain_id
@property
def project_domain_name(self):
- pass
+ c = conditions.BaseRule('runtest.tempest.enabled', 'eq', True)
+ return self.get_item_when_condition_match(
+ 'keystone.client.os_client_config.cfgs.root.content.'
+ 'clouds.admin_identity.auth.project_domain_name', c)
@property
def project_name(self):
@@ -297,11 +302,11 @@
@property
def user_domain_id(self):
- pass
+ return self.project_domain_id
@property
def user_domain_name(self):
- pass
+ return self.project_domain_name
@property
def username(self):
diff --git a/_modules/runtest/tempest_sections/identity.py b/_modules/runtest/tempest_sections/identity.py
index 7864cda..6fb64a1 100644
--- a/_modules/runtest/tempest_sections/identity.py
+++ b/_modules/runtest/tempest_sections/identity.py
@@ -2,6 +2,7 @@
import base_section
from runtest import conditions
+from runtest.tempest_sections.auth import Auth
class Identity(base_section.BaseSection):
@@ -50,7 +51,22 @@
@property
def default_domain_id(self):
- pass
+ c = conditions.BaseRule(field='keystone.client.enabled', op='eq',
+ val=True)
+ nodes = self.get_nodes_where_condition_match(c)
+ keystone_profile_admin = self.runtest_opts.get(
+ 'keystone_profile_admin', {})
+ res = self.authenticated_openstack_module_call(
+ nodes[0],
+ 'keystonev3.domain_list',
+ cloud_name=keystone_profile_admin)[nodes[0]]
+ auth = Auth(self.pillar, self.runtest_opts)
+ try:
+ domain_id = [d['id'] for d in res['domains']
+ if d['name'] == auth.admin_domain_name][0]
+ return domain_id
+ except Exception:
+ pass
@property
def disable_ssl_certificate_validation(self):