Implement set_availability method

By implementing this method we will decrease dependency
on SERVICE_NAMES. python-tempestconf loops over any
service which has a class implementation under
config_tempest/services directory. Therefore we can easily
set service availability in the loop by calling
set_availability method which sets appropriate values in
[service_available] section of tempest.conf.

This review also fixes the problem with not taking
service's versions into account when setting service
availability.

Story: 2002787
Task: 29632

Change-Id: Ica42fe6ae57eaef6bffd28b557f6b178a2ed8fb9
This commit is contained in:
Martin Kopec
2019-02-20 21:20:39 +00:00
parent ea5e1f5638
commit 33e39f3606
11 changed files with 59 additions and 30 deletions

View File

@@ -112,7 +112,15 @@ class Services(object):
# default tempest options
service.set_default_tempest_options(self._conf)
service.set_availability(self._conf, True)
self._services.append(service)
else:
# service is not available
# quickly instantiate a class in order to set
# availability of the service
s = s_class(None, None, None, None)
s.set_availability(self._conf, False)
def merge_exts_multiversion_service(self, service):
"""Merges extensions of a service given by its name
@@ -214,10 +222,6 @@ class Services(object):
return True
def set_service_availability(self):
# check if volume service is disabled
if self._conf.has_option('services', 'volume'):
if not self._conf.getboolean('services', 'volume'):
C.SERVICE_NAMES.pop('volume')
# check availability of volume backup service
volume.check_volume_backup_service(self._conf,
self._clients.volume_client,