Make the admin role configurable within tempest
Adds a configuration variable for the admin role.
Change-Id: Ib7f1eaaefedebd6f0d608b0645950d0b64d87f7a
Closes-Bug: #1224742
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 8d96858..3a33fd6 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -53,6 +53,9 @@
# The above administrative user's tenant name
admin_tenant_name = admin
+# The role that is required to administrate keystone.
+admin_role = admin
+
[compute]
# This section contains configuration options used when executing tests
# against the OpenStack Compute API.
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 22e1bd2..d6b4466 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -141,10 +141,11 @@
role = None
try:
roles = self._list_roles()
+ admin_role = self.config.identity.admin_role
if self.tempest_client:
- role = next(r for r in roles if r['name'] == 'admin')
+ role = next(r for r in roles if r['name'] == admin_role)
else:
- role = next(r for r in roles if r.name == 'admin')
+ role = next(r for r in roles if r.name == admin_role)
except StopIteration:
msg = "No admin role found"
raise exceptions.NotFound(msg)
diff --git a/tempest/config.py b/tempest/config.py
index 7245b10..a010be6 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -51,6 +51,9 @@
cfg.StrOpt('tenant_name',
default='demo',
help="Tenant name to use for Nova API requests."),
+ cfg.StrOpt('admin_role',
+ default='admin',
+ help="Role required to administrate keystone."),
cfg.StrOpt('password',
default='pass',
help="API key to use when authenticating.",