Enable keystone feature flags

This patch enables two settings in tempest.conf related to features that
are only available after the API version 3.6. Both settings are disabled
by default.

Change-Id: I781f31b18062a4f4e2363d36b0cb4bf6b49b1947
This commit is contained in:
Rodrigo Duarte Sousa 2017-04-11 11:39:29 -03:00
parent c9b3c78c72
commit 354bdb46fa
2 changed files with 29 additions and 0 deletions

View File

@ -175,6 +175,7 @@ def main():
configure_discovered_services(conf, services)
configure_boto(conf, services)
configure_keystone_feature_flags(conf, services)
configure_horizon(conf)
LOG.info("Creating configuration file %s", os.path.abspath(args.out))
with open(args.out, 'w') as f:
@ -726,6 +727,25 @@ def create_tempest_networks(clients, conf, has_neutron, public_network_id):
' must be specified')
def configure_keystone_feature_flags(conf, services):
"""Set keystone feature flags based upon version ID."""
supported_versions = services.get('identity', {}).get('versions', [])
for version in supported_versions:
major, minor = version.split('.')[:2]
# We are going to enable two feature flags that are available
# after version 3.6: one related to domain specific roles and
# another one related to the security compliance feature.
# For more information, see
# https://developer.openstack.org/api-ref/identity/v3
if major == 'v3' and int(minor) >= 6:
conf.set('identity-feature-enabled',
'forbid_global_implied_dsr',
'True')
conf.set('identity-feature-enabled',
'security_compliance',
'True')
def configure_boto(conf, services):
"""Set boto URLs based on discovered APIs."""
if 'ec2' in services:

View File

@ -196,6 +196,15 @@ class TestConfigTempest(BaseConfigTempestTest):
func2mock = 'config_tempest.api_discovery.get_identity_v3_extensions'
self.useFixture(MonkeyPatch(func2mock, mock_function))
def test_configure_keystone_feature_flags(self):
tool.configure_keystone_feature_flags(self.conf, self.FAKE_SERVICES)
self.assertEqual(
self.conf.get('identity-feature-enabled',
'forbid_global_implied_dsr'), 'True')
self.assertEqual(
self.conf.get('identity-feature-enabled',
'security_compliance'), 'True')
def test_configure_boto(self):
tool.configure_boto(self.conf, self.FAKE_SERVICES)
expected_url = "http://172.16.52.151:5000"