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

Partially implements bp external-plugin-interface
Change-Id: I3d28b93aa0cbd05cff3322ff60afadd18baf354a
Matthew Treinish 2015-07-23 13:06:13 -04:00
parent 83ad96edb5
commit 83a19aa4b1
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
2 changed files with 22 additions and 1 deletions

View File

@ -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]
return opt_list
# this should never be called outside of this class

View File

@ -51,6 +51,16 @@ class TempestPlugin(object):
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 []
class TempestTestPluginManager(object):
@ -79,3 +89,11 @@ class TempestTestPluginManager(object):
def register_plugin_opts(self, conf):
for plug in self.ext_plugins:
def get_plugin_options_list(self):
plugin_options = []
for plug in self.ext_plugins:
opt_list = plug.obj.get_opt_lists()
if opt_list:
return plugin_options