diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2020-12-08 11:32:25 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2020-12-08 23:21:29 +0100 |
commit | 3b8a04c4ed7025254fda33f4f3350c40f625b110 (patch) | |
tree | a7e7ed1d0ec764729eb0a82c27854614e6ea7fed | |
parent | 44bdf29110b95860f8742ec3ce81b165a3fda00f (diff) |
Concat both dynamic and static roles in tempest.conf
It also moves all auth logic in a specific method.
Change-Id: I95ecce84ef202c8fe72719c2263d96a76070c571
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit 8852b2d0128ddde3e45cacf6163000745b00b175)
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/tempest.py | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 55ec8fa6e..6d1720a75 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -280,19 +280,6 @@ class TempestCommon(singlevm.VmReady2): rconfig.set('compute-feature-enabled', 'live_migration', True) if os.environ.get('OS_REGION_NAME'): rconfig.set('identity', 'region', os.environ.get('OS_REGION_NAME')) - if env.get("NEW_USER_ROLE").lower() != "member": - rconfig.set( - 'auth', 'tempest_roles', - functest_utils.convert_list_to_ini([env.get("NEW_USER_ROLE")])) - if not json.loads(env.get("USE_DYNAMIC_CREDENTIALS").lower()): - rconfig.set('auth', 'use_dynamic_credentials', False) - account_file = os.path.join( - getattr(config.CONF, 'dir_functest_data'), 'accounts.yaml') - assert os.path.exists( - account_file), "{} doesn't exist".format(account_file) - rconfig.set('auth', 'test_accounts_file', account_file) - if env.get('NO_TENANT_NETWORK').lower() == 'true': - rconfig.set('auth', 'create_isolated_networks', False) rconfig.set('identity', 'admin_role', admin_role_name) rconfig.set('identity', 'default_domain_id', domain_id) if not rconfig.has_section('network'): @@ -506,6 +493,33 @@ class TempestCommon(singlevm.VmReady2): with open(rally_conf, 'w') as config_file: rconfig.write(config_file) + def update_auth_section(self): + """Update auth section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section("auth"): + rconfig.add_section("auth") + if env.get("NEW_USER_ROLE").lower() != "member": + tempest_roles = [] + if rconfig.has_option("auth", "tempest_roles"): + tempest_roles = functest_utils.convert_ini_to_list( + rconfig.get("auth", "tempest_roles")) + rconfig.set( + 'auth', 'tempest_roles', + functest_utils.convert_list_to_ini( + [env.get("NEW_USER_ROLE")] + tempest_roles)) + if not json.loads(env.get("USE_DYNAMIC_CREDENTIALS").lower()): + rconfig.set('auth', 'use_dynamic_credentials', False) + account_file = os.path.join( + getattr(config.CONF, 'dir_functest_data'), 'accounts.yaml') + assert os.path.exists( + account_file), "{} doesn't exist".format(account_file) + rconfig.set('auth', 'test_accounts_file', account_file) + if env.get('NO_TENANT_NETWORK').lower() == 'true': + rconfig.set('auth', 'create_isolated_networks', False) + with open(self.conf_file, 'w') as config_file: + rconfig.write(config_file) + def update_network_section(self): """Update network section in tempest.conf""" rconfig = configparser.RawConfigParser() @@ -614,6 +628,7 @@ class TempestCommon(singlevm.VmReady2): flavor_alt_id=self.flavor_alt.id, admin_role_name=self.role_name, cidr=self.cidr, domain_id=self.project.domain.id) + self.update_auth_section() self.update_network_section() self.update_compute_section() self.update_validation_section() |