Configure stable service clients via the registry
Push the configuration for stable service clients into the client
registry so that they may be automatically configured in clients.py.
This makes the stable service clients available and pre-configured
to both Tempest and all the plugins, removing the need for the
extra configuration step.
Once all tempest service clients will be stable, several pieces of
code will become redundant, as noted in the code itself.
Change-Id: I6a4845edb95031243bca12a8d03c60cf18528212
diff --git a/tempest/lib/services/clients.py b/tempest/lib/services/clients.py
index e782321..adf666b 100644
--- a/tempest/lib/services/clients.py
+++ b/tempest/lib/services/clients.py
@@ -18,7 +18,6 @@
import importlib
import inspect
import logging
-import six
from tempest.lib import auth
from tempest.lib.common.utils import misc
@@ -90,11 +89,14 @@
plug_service_versions))
raise exceptions.PluginRegistrationException(
name=plugin_name, detailed_error=detailed_error)
- if not plug_service_versions.isdisjoint(_tempest_modules):
+ # NOTE(andreaf) Once all tempest clients are stable, the following
+ # if will have to be removed.
+ if not plug_service_versions.isdisjoint(
+ _tempest_internal_modules()):
detailed_error = (
'Plugin %s is trying to register a service %s already '
'claimed by a Tempest one' % (plugin_name,
- _tempest_modules &
+ _tempest_internal_modules() &
plug_service_versions))
raise exceptions.PluginRegistrationException(
name=plugin_name, detailed_error=detailed_error)
@@ -351,15 +353,7 @@
raise exceptions.UnknownServiceClient(
services=list(client_parameters.keys()))
- # Register service clients owned by tempest
- for service, module in six.iteritems(tempest_modules()):
- attribute = service.replace('.', '_')
- configs = service.split('.')[0]
- self.register_service_client_module(
- attribute, service, module.__name__,
- module.__all__, **self.parameters[configs])
-
- # Register service clients from plugins
+ # Register service clients from the registry (__tempest__ and plugins)
clients_registry = ClientsRegistry()
plugin_service_clients = clients_registry.get_service_clients()
for plugin in plugin_service_clients:
@@ -432,6 +426,8 @@
@property
def registered_services(self):
+ # NOTE(andreaf) Once all tempest modules are stable this needs to
+ # be updated to remove _tempest_internal_modules
return self._registered_services | _tempest_internal_modules()
def _setup_parameters(self, parameters):