Add docstring example for get_opt_lists

Add an example (typical) implementation of get_opt_lists.

Change-Id: If597838f828f81c0919c11a8436b1a0d322758a4
This commit is contained in:
Andrea Frittoli 2017-04-24 11:02:39 +01:00
parent be0ba59743
commit f1c6825210

View File

@ -92,6 +92,31 @@ class TempestPlugin(object):
:return option_list: A list of tuples with the group name and options
in that group.
:rtype: list
Example::
# Config options are defined in a config.py module
service_option = cfg.BoolOpt(
"my_service", default=True,
help="Whether or not my service is available")
my_service_group = cfg.OptGroup(name="my-service",
title="My service options")
my_service_features_group = cfg.OptGroup(
name="my-service-features",
title="My service available features")
MyServiceGroup = [<list of options>]
MyServiceFeaturesGroup = [<list of options>]
# Plugin is implemented in a plugin.py module
from my_plugin import config as my_config
def get_opt_lists(self, conf):
return [
(my_service_group.name, MyServiceGroup),
(my_service_features_group.name, MyServiceFeaturesGroup)
]
"""
return []