Add plugin interface for extending sample config generation
This commit adds a method to the external plugin interface to extend the list of config options that gets passed to the sample config generator. Partially implements bp external-plugin-interface Change-Id: I3d28b93aa0cbd05cff3322ff60afadd18baf354a
This commit is contained in:
parent
83ad96edb5
commit
83a19aa4b1
@ -1224,7 +1224,10 @@ def list_opts():
|
||||
The purpose of this is to allow tools like the Oslo sample config file
|
||||
generator to discover the options exposed to users.
|
||||
"""
|
||||
return [(getattr(g, 'name', None), o) for g, o in _opts]
|
||||
ext_plugins = plugins.TempestTestPluginManager()
|
||||
opt_list = [(getattr(g, 'name', None), o) for g, o in _opts]
|
||||
opt_list.extend(ext_plugins.get_plugin_options_list())
|
||||
return opt_list
|
||||
|
||||
|
||||
# this should never be called outside of this class
|
||||
|
@ -51,6 +51,16 @@ class TempestPlugin(object):
|
||||
"""
|
||||
return
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_opt_lists(self):
|
||||
"""Method to get a list of options for sample config generation
|
||||
|
||||
:return option_list: A list of tuples with the group name and options
|
||||
in that group.
|
||||
:rtype: list
|
||||
"""
|
||||
return []
|
||||
|
||||
|
||||
@misc.singleton
|
||||
class TempestTestPluginManager(object):
|
||||
@ -79,3 +89,11 @@ class TempestTestPluginManager(object):
|
||||
def register_plugin_opts(self, conf):
|
||||
for plug in self.ext_plugins:
|
||||
plug.obj.register_opts(conf)
|
||||
|
||||
def get_plugin_options_list(self):
|
||||
plugin_options = []
|
||||
for plug in self.ext_plugins:
|
||||
opt_list = plug.obj.get_opt_lists()
|
||||
if opt_list:
|
||||
plugin_options.extend(opt_list)
|
||||
return plugin_options
|
||||
|
Loading…
Reference in New Issue
Block a user