When we log the warning that an option is deprecated for removal,
include the reason if we have one. Previously the deprecation reason was
only visible in the sample configuration file.
Add some tests for the log messages emitted when deprecated options are
used.
Change-Id: I5e309a3651041580fdf529ff31e18bbd90714f35
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
We deprecated and changed enforce_type's default value in [1],
need clean usage of enforce_type=True in oslo.config firstly.
This commit also makes enforce_type=True in fixture.
[1] https://review.openstack.org/#/c/328692/
Change-Id: I5b62427495179edb7672c6e5c508037f8b9d0b84
We changed enforce_type's default value to True in
Ifa552de0a994e40388cbc9f7dbaa55700ca276b0, which is not
backwards, so we need release 4.0.0 instead.
Change-Id: I234fa0aea55a9fb79483639f33716e1c125f370b
Use https instead of http to ensure the safety without containing our
account/password information
Change-Id: I4ec282dc25c4a2ba3988c7fb928c8918ff9ef318
Consuming projects usually don't set enforce_type=True by default,
and that will lead some invalid tests which don't honour Config options'
type and value limits. We began to warn user about the change since Sep,
2016 in I438aeb766d663dbfe5dbd263fd166c25814204e8. This change will
notify consuming project to write correct test cases with config
options.
This commit also fixes violations in oslo.config test:
config option 'namespace' is MultiStrOpt, need pass list
to conf.set_default().
Closes-Bug: #1517839
Change-Id: Ifa552de0a994e40388cbc9f7dbaa55700ca276b0
The sphinxext module attempts to allow string substitution for default
values in 'Opt.help'. This feature breaks when percentage signs are used
in option help texts and are not escaped. For example, the following
help text from nova:
help='Probability that peer will become a seeder (1.0 = 100%)'
Simply abort the attempt to substitute text in these cases.
Change-Id: Ia682cd9c91f07fec2faecb4338b777347f774073
Closes-Bug: #1675737
We reverted this before due to nova unit test failure, try
to fix unit test of Nova and add it as 'Depends-on' to
ensure we don't break Nova unit test again.
Depends-On: I61983d34269a44940bbb99783143767cf4c97cb1
Closes-Bug: #1640962
Change-Id: I1520df8c02873d2e65c6619d1b13dcf4558eec3d
With pbr 2.0 and Sphinx 1.5, the setting for treat sphinx warnings as
errors is setting warning-is-error in build_sphinx section. Migrate
the setting from the old warnerrors one.
There are a number of issues that need to resolved to make this work.
Most of these trivial enough but unfortunately the history document
contains issue due to its inclusion of ChangeLog, which is based on
commit message summary lines and contains some invalid rST. There
doesn't appear to be anyway to edit there retroactively nor disable
warnings on a specific files, thus the removal.
Change-Id: Ied79fc95d3711f8f3880e3e07e20f2c69b9a36ab
Since pbr already landed and the old version of hacking seems not
work very well with pbr>=2, we should update it to match global
requirement.
Partial-Bug: #1668848
Change-Id: I841d5073f8f84e2c0060fcdd4252d7c111c002e9
Few errors found in the config option docstrings. Namely:
* some parameters were missing from the doc
* nit: order of some parameters did not match docstring
* line break between parameters caused issue with the rendering
Change-Id: I50c6f70c7cff1fdabf83c180368933ccd4c65cc0
While config file opts cannot have a - in their name, CLI opts can
and the current deprecation code doesn't handle that case properly.
Additionally, because oslo.config has some magic to translate one
to the other it is possible we have existing users relying on the
wrong behavior. For this reason, let's add both forms of the opt
when adding deprecated opts. This will allow both to work as
expected.
The config generator is updated to ignore the - form of deprecated
opts since they won't work in a config file anyway.
I'm unsure how to filter the extra opts out of the help text, but
since both forms will work in that case it's a minor cosmetic
issue.
Change-Id: I4d2584b33d97fe00a427b992682d9eac391725a2
Closes-Bug: 1279973
There are libraries and tools which offer their config interface as
a stable backwards compatible interface both in code and as user
facing interface. A vital part of being able to make changes to this
is to handle deprecation and moving options. While oslo.config offers
a fairly rich deprecation mechanism it only exposes itself on the
user facing side. If a project wishes to deprecate an option for
code consumers who wish to use the config definitions externally they
will break by any change that deprecates an option. This commit fixes
this issue by doing a lookup on the deprecated options as a fallback
on a getattr. This way if an option is not found all the deprecated
options are checked, if a matching deprecated opt is found a warning
is logged and it's value is used.
Change-Id: I6e28c25f04273f7def486fadd541babc8cf423cb
We need to pass into VersionInfo what one would expect from running:
setup.py --name
Right now we pass in say oslo_context and pbr fails if there is no .git in
the python source tree
Closes-Bug: #1662266
Change-Id: I14e802131eab4fd4c1bdb2bde91c249e18f8236a
As noted in [1] oslo.config has a few broken links, this should fix the ones seen
in the oslo.config repo:
* Glossary has moved, use new URL
* Update config-reference to current URL.
[1]
http://lists.openstack.org/pipermail/openstack-docs/2017-January/009464.html
Change-Id: I922454c7791d4fb8e3834884462ce7311b223bd2
Now that there exists only a gate job for Python 3.5 and not 3.4,
we should remove those references to the 3.4 that is untested.
Change-Id: Iacd8ea7388a8e7c0c28b184a4b823a95aa04b987
interpolation use string.Template that always return str.
In most case, the caller convert the value to the option type.
But that doesn't work if the value is None.
This change make it works for None by replacing it by an empty string.
Closes-bug: #1654621
Change-Id: I9e318050d26277df99c9352dca70dc4ef4fbe13b
The current implementation doesn't distinguish between different
cases for the group sections. As result, some options are grouped in
different places or even duplicate their values. This change
normalize the group sections to lower case with the exception of
DEFAULT group.
Change-Id: Ia6bced383d36977005e2bf4532bdca9e9d4fe515
Closes-Bug: #1646084
We can already pass a usage string through, we should also be able to
pass the description and epilog through. Often some explanatory text
about how to combine the options productively is very useful.
Change-Id: I0cea0a22284ca8338658534c8c300bb9b7c93dd8
Adding constraints support to libraries is slightly more complex than
services as the libraries themselves are listed in upper-constraints.txt
which leads to errors that you can't install a specific version and a
constrained version.
This change adds constraints support by also adding a helper script to
edit the constraints to remove oslo.config.
Change-Id: I98622a0d783aa759e73df4e594afe409ad141bab
1.As mentioned in [1], we should avoid using
six.iteritems to achieve iterators. We can
use dict.items instead, as it will return
iterators in PY3 as well. And dict.items/keys
will more readable. 2.In py2, the performance
about list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Change-Id: I8b1e3dd75c700c3c2d41223309cd6c3af1ebdddc
When config options in different projects use IPOpt as the opt's
type, it restricts operators to only IP addresses.
When the opt is set to HostnameOpt type, currently even an
incomplete or invalid IP passes as a valid hostname. Also, currently
HostnameOpt does not make sure that there is a presense of at least one
non-numeric character in the provided host name.
According to RFC 1123, (https://tools.ietf.org/html/rfc1123),
a valid host name can never have the dotted-decimal form #.#.#.#,
since at least the highest-level component label will be alphabetic.
This patch fixes the existing Hostname Opt to abide by the stated RFC
and also adds a new opt type that would enable operators to provide
either a hostname or an IP and at the same time perform checks on
both IPOpt type and HostnameOpt type, by setting opt type to
"HostAddressOpt" type. This would ensure that an invalid IP does
not pass as a valid hostname and at the same time retains the rules
required to be followed for the validation of an acceptable hostname.
Change-Id: I77bdb64b7e6e56ce761d76696bc4448a9bd325eb
Closes-Bug: #1619044
Closes-Bug: #1615028
Replace some unnecessarily iterative/functional idioms with more
Pythonic ones.
Also eliminate duplication between find_config_dirs and
find_config_files.
Change-Id: I678a7b072d195be9a4271dc5b2a9b5c300098cb0
If no --config-dir switches are given on the command
line, use default directories to search for config
snippets.
This is similar to the default config-file support
oslo.config already includes. It is useful in environments
where command line arguments can not easily be added, like
mod_wsgi Apache envs.
Change-Id: I4df977911539777d1510e8b579375aca5b5f15f4