From 54fb3269c06a728322bf82ce7f09eee403229fac Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Wed, 12 Nov 2014 12:47:03 -0500 Subject: [PATCH] Add oslo.config.opts entry_points in setup.cfg oslo-config-generator relies on these entry_points listed in setup.cfg to add options to the generated sample conf files in different projects. So we should expose options in oslo.log. Closes-Bug: #1391742 Change-Id: I7c339484f17c4067ad7c82eb7f7208ef6d8be417 --- oslo/log/_options.py | 22 ++++++++++++++++++++++ setup.cfg | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/oslo/log/_options.py b/oslo/log/_options.py index a730b933..6ded595a 100644 --- a/oslo/log/_options.py +++ b/oslo/log/_options.py @@ -10,6 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. +import copy + from oslo.config import cfg _DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" @@ -130,3 +132,23 @@ log_opts = [ help='The format for an instance UUID that is passed with the ' 'log message.'), ] + + +def list_opts(): + """Returns a list of oslo.config options available in the library. + + The returned list includes all oslo.config options which may be registered + at runtime by the library. + + Each element of the list is a tuple. The first element is the name of the + group under which the list of elements in the second element will be + registered. A group name of None corresponds to the [DEFAULT] group in + config files. + + The purpose of this is to allow tools like the Oslo sample config file + generator to discover the options exposed to users by this library. + + :returns: a list of (group_name, opts) tuples + """ + return [(None, copy.deepcopy(common_cli_opts + logging_cli_opts + + generic_log_opts + log_opts))] diff --git a/setup.cfg b/setup.cfg index 15f7261f..786ef4ed 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,6 +28,10 @@ namespace_packages = [pbr] warnerrors = true +[entry_points] +oslo.config.opts = + oslo.log = oslo.log._options:list_opts + [build_sphinx] source-dir = doc/source build-dir = doc/build