make configuration options discoverable

Add an entry point to make the configuration options defined in the
library discoverable for the sample configuration generator.

Add the configuration options to the library documentation.

Change-Id: I5b49fef1d0363d8887a84cdc3cec242efe1b9084
This commit is contained in:
Doug Hellmann 2015-09-24 20:07:03 +00:00
parent 3b2071a96b
commit 50a8b1b937
5 changed files with 50 additions and 1 deletions

View File

@ -23,7 +23,8 @@ sys.path.insert(0, os.path.abspath('../..'))
extensions = [
'sphinx.ext.autodoc',
#'sphinx.ext.intersphinx',
'oslosphinx'
'oslosphinx',
'oslo_config.sphinxext',
]
# autodoc generation is a bit aggressive and a nuisance when doing heavy

View File

@ -22,6 +22,7 @@ Contents
installation
api/index
usage
opts
contributing
Release Notes

9
doc/source/opts.rst Normal file
View File

@ -0,0 +1,9 @@
=======================
Configuration Options
=======================
oslo.versionedobjects uses oslo.config to define and manage
configuration options to allow the deployer to control how an
application using oslo.versionedobjects behaves.
.. show-options:: oslo.versionedobjects

View File

@ -0,0 +1,34 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
from oslo_versionedobjects import exception
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 [('oslo_versionedobjects', copy.deepcopy(exception.exc_log_opts))]

View File

@ -22,6 +22,10 @@ classifier =
packages =
oslo_versionedobjects
[entry_points]
oslo.config.opts =
oslo.versionedobjects = oslo_versionedobjects._options:list_opts
[extras]
fixtures =
mock>=1.2