aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils
diff options
context:
space:
mode:
authorJuha Kosonen <juha.kosonen@nokia.com>2017-08-11 09:31:25 +0300
committerJuha Kosonen <juha.kosonen@nokia.com>2017-08-15 13:54:18 +0300
commit3ed570c27587e69f384a6e9ab2711d553b7dcde6 (patch)
tree3fd9205e23c1398116caad39c49a12d48f78cee7 /functest/utils
parent42877bb48714293d3ec761f42007fcc8fa925724 (diff)
Fix domain in tenant creation
Use the ID of the domain when creating a tenant on keystone v3. Change-Id: Ic415237e2bb2d537f07ab2245816a575f977aaa0 Signed-off-by: Juha Kosonen <juha.kosonen@nokia.com>
Diffstat (limited to 'functest/utils')
-rw-r--r--functest/utils/openstack_utils.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index 1bdfa253..335f14cd 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -22,6 +22,7 @@ from heatclient import client as heatclient
from novaclient import client as novaclient
from keystoneclient import client as keystoneclient
from neutronclient.neutron import client as neutronclient
+from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
@@ -1376,13 +1377,25 @@ def get_role_id(keystone_client, role_name):
return id
+def get_domain_id(keystone_client, domain_name):
+ domains = keystone_client.domains.list()
+ id = ''
+ for d in domains:
+ if d.name == domain_name:
+ id = d.id
+ break
+ return id
+
+
def create_tenant(keystone_client, tenant_name, tenant_description):
try:
if is_keystone_v3():
+ domain_name = CONST.__getattribute__('OS_PROJECT_DOMAIN_NAME')
+ domain_id = get_domain_id(keystone_client, domain_name)
tenant = keystone_client.projects.create(
name=tenant_name,
description=tenant_description,
- domain="default",
+ domain=domain_id,
enabled=True)
else:
tenant = keystone_client.tenants.create(tenant_name,