Remove support for identity section in tempest.conf

Support for identity section in tempest.conf was deprecated 7 years ago
by the refstack-client [1].

This patch simply makes sure that the refstack-client ends with an error
and prints an error message when the user tries to use identity section
instead of accounts.yaml.

[1] https://review.opendev.org/c/openinfra/refstack-client/+/287540

Change-Id: I9e6cce47ffd4269fecdb3ad040d508acb1be671c
This commit is contained in:
Lukáš Piwowarski 2022-11-30 15:20:26 +01:00
parent 340344526b
commit 92ae48007c
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):
"""