summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Percoco <flaper87@gmail.com>2014-09-03 18:18:58 +0200
committerFlavio Percoco <flaper87@gmail.com>2014-09-03 18:18:58 +0200
commit10fa16906e91b94f40ff68d00544c70cb975c857 (patch)
tree8420f26137b965fca507a6c665249b82fe5315fe
parentdc5081aab5d0d7e1124263831839e493f21b0bfb (diff)
downloadoslo-config-10fa16906e91b94f40ff68d00544c70cb975c857.tar.gz
Explain groups for DeprecatedOpts
The patch extends the documentation for `DeprecatedOpt` and explains that group==None means the deprecated name will be looked up in the same group. Change-Id: I54ba414d6a6862e1b00dfbf589563ef9f4df5cf3
-rw-r--r--oslo/config/cfg.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/oslo/config/cfg.py b/oslo/config/cfg.py
index 0ff708e..f41264a 100644
--- a/oslo/config/cfg.py
+++ b/oslo/config/cfg.py
@@ -835,6 +835,18 @@ class DeprecatedOpt(object):
deprecated options are present, the option corresponding to
the first element of deprecated_opts will be chosen.
+ If group is None, the DeprecatedOpt lookup will happen within the same
+ group the new option is in. For example::
+
+ oldopts = [cfg.DeprecatedOpt('oldfoo'),
+ cfg.DeprecatedOpt('oldfoo2', group='DEFAULT')]
+
+ cfg.CONF.register_group(cfg.OptGroup('blaa'))
+ cfg.CONF.register_opt(cfg.StrOpt('foo', deprecated_opts=oldopts),
+ group='blaa')
+
+ In the example above, `oldfoo` will be looked up in the `blaa` group and
+ `oldfoo2` in the `DEFAULT` group.
"""
def __init__(self, name, group=None):