Merge "Remove support for identity section in tempest.conf"

This commit is contained in:
Zuul 2023-01-10 00:42:50 +00:00 committed by Gerrit Code Review
commit 8e3718fd5a
2 changed files with 14 additions and 34 deletions

View File

@ -211,38 +211,20 @@ class RefstackClient:
'project_id': project_id, 'project_name': project_name
}
elif conf_file.has_option('identity', 'username'):
self.logger.warn('Using identity section of tempest config '
'file to specify user credentials is '
'deprecated and won\'t be supported soon. '
'User credentials should be defined in the '
'accounts file as described in the Tempest '
'configuration guide (http://docs.openstack.'
'org/developer/tempest/configuration.html).')
username = conf_file.get('identity', 'username')
password = conf_file.get('identity', 'password')
if self.conf.has_option('identity', 'tenant_id'):
project_id = conf_file.get('identity', 'tenant_id')
elif self.conf.has_option('identity', 'project_id'):
project_id = conf_file.get('identity', 'project_id')
else:
project_id = None
project_name = (conf_file.get('identity', 'tenant_name',
fallback=False) or
conf_file.get('identity', 'project_name'))
return {'auth_version': auth_version,
'auth_url': auth_url,
'domain_name': domain_name,
'username': username, 'password': password,
'tenant_id': project_id, 'tenant_name': project_name,
'project_id': project_id, 'project_name': project_name}
self.logger.error('Using identity section in tempest config '
'file to specify user credentials is no '
'longer supported. User credentials should '
'be defined in the accounts file as '
'described in the Tempest configuration '
'guide (https://docs.openstack.org/tempest/'
'latest/configuration.html).')
exit(1)
else:
self.logger.error('User credentials cannot be found. '
'User credentials should be defined in the '
'accounts file as described in the Tempest '
'configuration guide (http://docs.openstack.'
'org/developer/tempest/configuration.html).')
'org/tempest/latest/configuration.html).')
exit(1)
except moves.configparser.Error as e:
# Most likely a missing section or option in the config file.

View File

@ -189,19 +189,17 @@ class TestRefstackClient(unittest.TestCase):
def test_get_keystone_config_no_accounts_file(self):
"""
Test that the client will read account info from
tempest.conf when the accounts file is not specified.
Test that the client will exit if accounts file
is not specified.
"""
args = rc.parse_cli_args(self.mock_argv())
client = rc.RefstackClient(args)
client.tempest_dir = self.test_path
client._prep_test()
self.mock_data()
actual_result = client._get_keystone_config(client.conf)
expected_result = self.v2_config
self.assertEqual(expected_result, actual_result)
with self.assertRaises(SystemExit):
client._get_keystone_config(client.conf)
def test_get_keystone_config(self):
"""