Move configuring of services to services class

Move checking availability of services from main:config_tempest
to services:services:set_service_availability.

Change-Id: Iafa1ff774c70216d22442eeaaba42d90f66bda62
This commit is contained in:
Martin Kopec 2018-05-29 09:16:46 +00:00
parent ebbd17a1ce
commit 154fe8878d
4 changed files with 19 additions and 16 deletions

View File

@ -49,11 +49,7 @@ from credentials import Credentials
from flavors import Flavors
import os_client_config
from oslo_config import cfg
from services import boto
from services import ceilometer
from services.horizon import configure_horizon
from services.services import Services
from services import volume
import tempest_conf
from users import Users
@ -405,13 +401,6 @@ def config_tempest(**kwargs):
services.set_service_availability()
services.set_supported_api_versions()
services.set_service_extensions()
volume.check_volume_backup_service(conf, clients.volume_client,
services.is_service("volumev3"))
ceilometer.check_ceilometer_service(conf, clients.service_client)
boto.configure_boto(conf, s3_service=services.get_service("s3"))
identity = services.get_service('identity')
identity.configure_keystone_feature_flags(conf)
configure_horizon(conf)
# remove all unwanted values if were specified
if remove != {}:

View File

@ -95,7 +95,7 @@ class IdentityService(VersionedService):
except KeyError:
return [body['version']['id']]
def configure_keystone_feature_flags(self, conf):
def set_default_tempest_options(self, conf):
"""Set keystone feature flags based upon version ID."""
supported_versions = self.get_versions()
if len(supported_versions) <= 1:

View File

@ -16,19 +16,22 @@
import urlparse
from base import Service
import boto
import ceilometer
from compute import ComputeService
import config_tempest.constants as C
import horizon
from identity import IdentityService
from image import ImageService
from network import NetworkService
from object_storage import ObjectStorageService
from volume import VolumeService
import volume
service_dict = {'compute': ComputeService,
'image': ImageService,
'network': NetworkService,
'object-store': ObjectStorageService,
'volumev3': VolumeService,
'volumev3': volume.VolumeService,
'identity': IdentityService}
@ -194,6 +197,17 @@ class Services(object):
if not self._conf.getboolean('services', 'volume'):
C.SERVICE_NAMES.pop('volume')
C.SERVICE_VERSIONS.pop('volume')
# check availability of volume backup service
volume.check_volume_backup_service(self._conf,
self._clients.volume_client,
self.is_service("volumev3"))
ceilometer.check_ceilometer_service(self._conf,
self._clients.service_client)
boto.configure_boto(self._conf, s3_service=self.get_service("s3"))
horizon.configure_horizon(self._conf)
for service, codename in C.SERVICE_NAMES.iteritems():
# ceilometer is still transitioning from metering to telemetry

View File

@ -82,10 +82,10 @@ class TestIdentityService(BaseServiceTest):
@mock.patch('config_tempest.services.identity'
'.IdentityService.get_versions')
def test_configure_keystone_feature_flags(self, mock_get_versions):
def test_set_default_tempest_options(self, mock_get_versions):
conf = TempestConf()
mock_get_versions.return_value = ['v3.8', 'v2.0']
self.Service.configure_keystone_feature_flags(conf)
self.Service.set_default_tempest_options(conf)
self.assertEqual(
conf.get('identity-feature-enabled',
'forbid_global_implied_dsr'), 'True')