summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavanum Srinivas <dims@linux.vnet.ibm.com>2014-11-12 12:47:03 -0500
committerDavanum Srinivas <dims@linux.vnet.ibm.com>2014-11-18 06:36:58 -0500
commit54fb3269c06a728322bf82ce7f09eee403229fac (patch)
treefcfbe6cdf22b40bea5bc6e2264f75b9d5abdc15b
parent320b1c08c48d27692e3f73690a4c904052119d68 (diff)
downloadoslo-log-54fb3269c06a728322bf82ce7f09eee403229fac.tar.gz
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
-rw-r--r--oslo/log/_options.py22
-rw-r--r--setup.cfg4
2 files changed, 26 insertions, 0 deletions
diff --git a/oslo/log/_options.py b/oslo/log/_options.py
index a730b93..6ded595 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 15f7261..786ef4e 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