Commit Graph

854 Commits

Author SHA1 Message Date
Doug Hellmann
12fd34b963 add deprecation_reason to log message
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>
2017-04-25 11:01:42 -04:00
Takashi NATSUME
4cc7c6cb9b Fix string interpolation in ValueError
Change-Id: Ief34fbf75a28c46b95c08a4d7ae2cb831607a05b
Closes-Bug: #1684771
2017-04-21 09:06:51 +09:00
Jenkins
bab4d4c6e3 Merge "Remove usage of enforce_type=True" 2017-04-13 15:23:38 +00:00
Jenkins
1132586cb9 Merge "Adjust removal_version for argument enforce_type" 2017-04-13 15:23:31 +00:00
Jenkins
8de5a4f6ed Merge "Optimize the link address" 2017-04-13 06:44:48 +00:00
ChangBo Guo(gcb)
04a78cc1d0 Remove usage of enforce_type=True
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
2017-04-11 14:27:53 +08:00
ChangBo Guo(gcb)
bb8b134b1c Adjust removal_version for argument enforce_type
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
2017-04-11 09:29:03 +08:00
Jenkins
827bd738dc Merge "Make set_override/set_default with enforce_type=True by default" 2017-04-10 04:19:02 +00:00
loooosy
997c856088 Optimize the link address
Use https instead of http to ensure the safety without containing our
account/password information

Change-Id: I4ec282dc25c4a2ba3988c7fb928c8918ff9ef318
2017-04-08 22:42:22 +08:00
Jenkins
8a0881f217 Merge "sphinxext: Handle unescaped percentage signs" 2017-04-07 12:53:22 +00:00
ChangBo Guo(gcb)
3a8ba0f8ea Make set_override/set_default with enforce_type=True by default
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
2017-04-05 14:26:40 +08:00
Jenkins
efb287a946 Merge "Use Sphinx 1.5 warning-is-error" 2017-03-29 23:49:15 +00:00
Jenkins
6b53b10bc7 Merge "Add HACKING.rst" 2017-03-29 15:41:14 +00:00
Jenkins
e523607cef Merge "Fix conversion to item_type on __call__ in List type(again)" 2017-03-28 16:17:43 +00:00
Stephen Finucane
2aba5594d9 sphinxext: Handle unescaped percentage signs
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
2017-03-24 11:27:34 +00:00
hnyang
4624e9694b Remove log translations
Log messages are no longer being translated. This
removes all use of the _LE, _LI, and _LW translation markers to simplify
logging and to avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: I9474117444e0f16cee32ddce97a82cbf7c3e8f37
Closes-Bug: 1674577
2017-03-24 11:02:35 +08:00
ZhongShengping
dcab6176de Add HACKING.rst
Change-Id: Ib2befa986083771661e0ee8e9dfc85a490c6413d
2017-03-24 10:40:50 +08:00
Gevorg Davoian
466fcc1755 Fix conversion to item_type on __call__ in List type(again)
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
2017-03-17 16:48:18 +08:00
Stephen Finucane
32d23459dc Use Sphinx 1.5 warning-is-error
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
2017-03-16 15:38:35 +00:00
Jenkins
b1cf3141b9 Merge "Handle both - and _ forms of deprecated opts" 2017-03-14 08:05:38 +00:00
Jenkins
e53c79ebbb Merge "Fix up the option docs" 2017-03-03 12:55:20 +00:00
Jenkins
27cc347842 Merge "Handle getattrs to ConfigOpts for deprecated opts" 2017-03-03 04:52:39 +00:00
OpenStack Proposal Bot
dcdce8f44e Updated from global requirements
Change-Id: I08b39bbde8378d75dce026e03bb708f661195069
2017-03-03 00:02:50 +00:00
ricolin
851e305c63 [Fix gate]Update test requirement
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
2017-03-02 18:13:10 +08:00
Eric Brown
e0f96fa022 Fix up the option docs
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
2017-02-28 21:41:52 -08:00
Ben Nemec
0c6040ef6b Handle both - and _ forms of deprecated opts
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
2017-02-28 00:22:21 +00:00
Matthew Treinish
29d3345bb5
Handle getattrs to ConfigOpts for deprecated opts
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
2017-02-22 14:25:30 -05:00
OpenStack Proposal Bot
572003b836 Updated from global requirements
Change-Id: Ifb013d09adb7a1fa045380e7bed71428a67790e3
2017-02-10 05:57:31 +00:00
Davanum Srinivas
d7d497aa09 pbr.version.VersionInfo needs package name (oslo.xyz and not oslo_xyz)
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
2017-02-06 12:49:23 -05:00
73b68c0b27 Update reno for stable/ocata
Change-Id: I8cf513a719f766c6aff8f6c79b4290f9e1fa6757
2017-01-20 19:15:17 +00:00
zhangyanxian
f48b20bcff Fix typo in generator.rst
TrivialFix

Change-Id: I19b4ccde26204e8f9a5179960291dc49ea0bd208
2017-01-20 07:34:19 +00:00
Andreas Jaeger
3025b6f736 Fix broken links
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
2017-01-13 08:29:38 +01:00
OpenStack Proposal Bot
54ccc7ad83 Updated from global requirements
Change-Id: I6e130711ae097a77118706d850c47f0dcaca8662
2017-01-10 18:50:50 +00:00
Jenkins
42ecc95163 Merge "Remove references to Python 3.4" 2017-01-10 15:38:18 +00:00
Jenkins
3ffb18ea60 Merge "fix interpolation of None value" 2017-01-09 20:11:05 +00:00
Eric Brown
08eff4f4d6 Remove references to Python 3.4
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
2017-01-09 10:05:36 -08:00
Mehdi Abaakouk
71075cec20 fix interpolation of None value
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
2017-01-09 12:50:02 +01:00
Jenkins
978522a8b2 Merge "Normalize group sections" 2016-12-23 12:51:34 +00:00
Victor Morales
1dbf887909 Normalize group sections
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
2016-12-19 17:40:59 -06:00
Alexis Lee
e5269392d8 config: Pass description and epilog through
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
2016-12-15 14:18:56 +00:00
Tony Breeds
30dbe55791 Add Constraints support
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
2016-12-14 22:04:42 +11:00
gengchc2
036d245a5e Replace six.iteritems() with .items()
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
2016-12-09 11:37:11 +08:00
Jenkins
bb8846a3ab Merge "Fixing HostName and adding support for HostAddress" 2016-12-07 06:35:28 +00:00
Dharini Chandrasekar
babff882c0 Fixing HostName and adding support for HostAddress
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
2016-12-07 03:27:45 +00:00
Jenkins
aed4dcd893 Merge "Show team and repo badges on README" 2016-12-01 14:44:04 +00:00
Jenkins
44f8c64d8c Merge "List comprehensions" 2016-12-01 11:47:28 +00:00
Jenkins
7a1df8bc71 Merge "Add defaults for config-dir" 2016-11-30 14:41:03 +00:00
Alexis Lee
c4ced953ce List comprehensions
Replace some unnecessarily iterative/functional idioms with more
Pythonic ones.

Also eliminate duplication between find_config_dirs and
find_config_files.

Change-Id: I678a7b072d195be9a4271dc5b2a9b5c300098cb0
2016-11-30 10:35:00 +00:00
Thomas Bechtold
f24b04ea87 Add defaults for config-dir
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
2016-11-30 06:58:12 +01:00
Atsushi SAKAI
36ee449a7a Fix filename in comment
${prog.conf} => ${prog}.conf

Change-Id: I703794243d14bd4815da0f62ddc8f81f83283c93
2016-11-29 16:16:35 +09:00