1017 Commits

Author SHA1 Message Date
Doug Hellmann
bd463ee3b6 move some documentation out of the source files
The cfg module is very large, and starts with a huge block of
documentation. This patch moves that information into separate files
in the reference section of the docs. A few formatting fixes need to
be made to have it build cleanly, but the content is not changed in a
substantive way.

Change-Id: I86aa90bbf180b5dc9acbcedb024e5361d49954c3
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-07-19 17:26:38 -04:00
Raildo Mascena
ce150b1037 New cache layer for external sources
Add a separate cache for values coming from external sources,
this will protect us from having options from external sources
mutated when we reload the configuration files

Change-Id: Icf72f4e1745a0ddf53e661cc08d0fe7428cd9a41
Blueprint: oslo-config-drivers
2018-07-17 23:54:56 +00:00
Doug Hellmann
b79f763b49 ensure we do not modify private data from drivers
When we ask for a list of options from a drivere for generating the
sample config or documentation, we want to insert the actual 'driver'
option at the front of the list. This keeps each driver from having to
do that, and allows us to generate the sample with good
defaults. However, if a driver returns us a static data structure, we
do not want to modify *that* set of data, because the driver tests
will need the original structure intact. So, have list_opts() deepcopy
the data it is given, again to avoid having to ensure each driver
author does that copy.

This change also requires updating the test for list_opts() for the
URI driver to no longer assume the 'driver' option will be in the
results. At the same time I am reordering the arguments to
assertEqual() so that the expected value is listed first and renaming
the variable holding the actual values from the discovery call.

Change-Id: Ie8c1bc606f5f69a72b2383200a40b26e252067a9
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-07-17 12:35:13 -04:00
Zuul
45425e938d Merge "User guide documentation for backend drivers for oslo.config" 2018-07-16 23:31:43 +00:00
Zuul
cd5b37be18 Merge "add detail to driver options in config generator" 2018-07-16 15:07:57 +00:00
Zuul
6ddee6d29a Merge "Add example group for the URI driver" 2018-07-13 16:08:33 +00:00
Zuul
084ac31f4c Merge "Add config_source option" 2018-07-13 16:08:32 +00:00
Zuul
e95a4ce8c3 Merge "Create INI file ConfigurationSourceDriver." 2018-07-13 16:08:31 +00:00
Zuul
adba3da492 Merge "ConfigurationSource base class" 2018-07-13 16:08:30 +00:00
Zuul
f51fb759b3 Merge "Base class for a configuration driver" 2018-07-13 16:08:29 +00:00
Zuul
f534a5e2ec Merge "move configuration option list to the configuration guide" 2018-07-10 06:29:12 +00:00
Raildo Mascena
e8c93ea5ba User guide documentation for backend drivers for oslo.config
New documentation sections explaning how to use the backend
drivers for oslo.config, also include explanation on how to
use the remote_file driver.

Change-Id: I45fc2155f6fe2d8bee058dac880afba8bb9bfd53
Blueprint: oslo-config-drivers
2018-07-05 14:44:15 +00:00
Doug Hellmann
5ad89d4021 add detail to driver options in config generator
Have the main _list_opts caller construct the driver option so
individual drivers do not need to repeat that.

Add choices with descriptions when emitting samples. We don't really
care about those for the runtime use, but they improve the output in
the config generator and documentation.

Use an OptGroup with the driver_option and dynamic_group_owner options
set instead of just a group name when describing the options.

Add sample_default values for some of the options in the URI driver.

Change-Id: I14c0a046e6c70a9108308db70a4efb70613d5bb3
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-07-05 11:42:34 -03:00
Zuul
df0a57438f Merge "Optionally use oslo.log for deprecated opt logging" 2018-06-29 14:42:11 +00:00
Doug Hellmann
6a94cbc6a2 move configuration option list to the configuration guide
We have a section in the reference guide showing the configuration
options built into oslo.config. Move that to the configuration guide
instead so it is linked from the Configuration Guide list at
https://docs.openstack.org/$series/configuration/ like the similar
documentation for other libraries.

Change-Id: I7da159cfaa643c2cc094f6fb1c0aeaa956f3eb77
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-28 10:55:07 -04:00
Moises Guimaraes de Medeiros
8b1a0ff417 Add example group for the URI driver
Ensure the sample generator emits an example group with
instructions on how to define extra URI sources.

Change-Id: Ica556771d8dd37cb02d9ca69c04e888d187041ee
Blueprint: oslo-config-drivers
Signed-off-by: Moises Guimaraes de Medeiros <moguimar@redhat.com>
2018-06-25 10:38:54 +02:00
Doug Hellmann
e233fc58da Add config_source option
Define a config_source option that can be used to specify the
alternative sources that require drivers to load configuration
settings.

Co-Authored-By: Moises Guimaraes de Medeiros <moguimar@redhat.com>
Change-Id: Ibd5a6d306bb98d30d973dfe3604dcc0691d2e369
Blueprint: oslo-config-drivers
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-25 10:17:12 +02:00
Ben Nemec
5f8b0e0185 Optionally use oslo.log for deprecated opt logging
While we can't add a hard dependency on oslo.log because it uses
oslo.config, in most cases oslo.log will be installed anyway.  In
the interest of being able to make use of features like
fatal_deprecations in oslo.log, let's use it if it's available.

Change-Id: If9499aa6fc28a6b92447b3825d3ca1957cb2255a
2018-06-21 14:50:47 +00:00
melissaml
9c71b01409 Add release notes link to README
Change-Id: I2733816f92eaa1f50c6abc022205f5a3dedfb387
2018-06-21 13:15:22 +08:00
Stephen Finucane
d85735d1b2 tox: Fix typo
This was introduced in change I87b30273. While we're here, we also start
passing positional arguments to 'sphinx-build' so we can configure it
somewhat dynamically.

Change-Id: I766da57377cd2ddb0a82419e36eeec1046309948
2018-06-18 12:33:08 +01:00
Stephen Finucane
eb6b43ba06 sphinxext: Reporting correct lines for errors
Previously, we had an issue whereby errors found in the generated source
would result in the following, rather unhelpful error messages:

  <oslo_config.sphinxext>:1: WARNING: Unexpected indentation.

Turns out that the 'ViewList.append' function takes a third argument,
'offset', to indicate where in the source an error is occurring. Start
using this to improve the quality of the error messages we get from
poorly formatted options. Given that we don't actually modify the source
file, it's also necessary to write the output from the directive to an
intermediate temp file.

This also fixes the order of imports, given that we're adding new
imports as we go.

Change-Id: I6f6796629705926dbed5015f20d47187b77c9c50
Related-Bug: #1755783
2018-06-18 12:29:18 +01:00
Stephen Finucane
9fb043606e sphinxext: Address nits from Ic6c2dcbe7823dd3fdc71db8dc5afab2d604559e3
Change-Id: Idf8bf0c385c6b61f644b0974c9ec93fccf4372c7
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2018-06-18 11:51:28 +01:00
Doug Hellmann
1319cfb476 improve the documentation for option location information
Fix an error in the example code by setting loc to the Location enum
value instead of the LocationInfo tuple.

Add a cross-reference from the ConfigOpts get_location() method to the
more extensive reference documentation about option locations.

Change-Id: Ic9850afd78a7b42f4e807b04e78729a674942e15
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-13 13:37:16 -04:00
Doug Hellmann
c8a8f4eba1 fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

Change-Id: I4b329f3233ce126fb25bff6c947aa8379b991d59
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-06 14:57:00 -04:00
Moises Guimaraes de Medeiros
9dfca14683 Create INI file ConfigurationSourceDriver.
The configuration source driver looks for an URI to setup the INIConfigurationSource.
The INIConfigurationSource class was created as a placeholder for now.
The allowed shemes so far are 'http' and 'https', we can add 'file' to also support
opening files from a path like: "file:///etc/foo/bar.conf"

Change-Id: I2e220346b2e3a0ea2171e28d785bf06f0abeb12b
Signed-off-by: Moises Guimaraes de Medeiros <moguimar@redhat.com>
2018-06-06 16:03:27 +02:00
Samuel Pilla
c5e57c0aef ConfigurationSource base class
Creates and abstract base class for configuration sources
to be implemented off of.

Change-Id: I238930df61749a77b0a0aa4f033375972a159931
Blueprint: oslo-config-drivers
2018-05-23 17:23:06 +02:00
Raildo Mascena
232172913b Base class for a configuration driver
Create a base class to support a configuration driver for Oslo.config

Change-Id: Idec1456c00dedb8c3628cbc4a934b870cd8dc7fc
Patially-Implements: blueprint oslo-config-db
2018-05-15 11:34:17 -04:00
Doug Hellmann
969fecd369 fix lower-constraints
We cannot modify the requirements list until the existing lower
constraints values are correct.

Change-Id: I8ed238bfcb6e11a0b5e28404ccb93e88e01d83b7
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-05-15 11:34:17 -04:00
Lance Bragstad
3e7eecc9f4 Properly initialize HostAddress
The HostAddress class wasn't calling super in it's __init__() method,
which resulted in the type_name not being set properly for instances
of that class.

Change-Id: I4e589f2081e5d95227938cba9ad1158548bc1048
Closes-Bug: 1768498
2018-05-07 22:21:17 +00:00
Kenneth Giusti
96e9a3471a Remove stale pip-missing-reqs tox test
pip_missing_reqs tool is no longer maintained and has broken with
release 10 of pip

Refer to:
 http://lists.openstack.org/pipermail/openstack-dev/2018-April/130027.html

Change-Id: I08712ccb25ecda617bb90363c5171f8720a34029
2018-05-01 09:24:01 -04:00
Ben Nemec
198f539bb8 Remove boolean from StrOpt example
I'm not sure why this was here, but it doesn't make sense since
we're documenting StrOpts in this section.

Change-Id: I74c73c8088ec266d1f827bc51b4d78fc7be48a38
2018-04-24 14:12:46 +00:00
Zuul
10caf02237 Merge "use environment variable to control file location probing" 2018-04-23 17:23:32 +00:00
Zuul
132c3823f6 Merge "fix URI type equality comparison" 2018-04-23 17:14:59 +00:00
Zuul
f55d5eef91 Merge "Trivial: Update pypi url to new url" 2018-04-23 15:58:23 +00:00
melissaml
a46a9bed3b Trivial: Update pypi url to new url
Pypi url changed from [1] to [2]

[1] https://pypi.python.org/pypi/<package>
[2] https://pypi.org/project/<package>

Change-Id: I97b4453f941b7593f3991ec79aeb6d532437c60c
2018-04-21 11:12:06 +08:00
Doug Hellmann
ad93ae1f07 fix URI type equality comparison
It does not make sense to compare the value of two URIs for equality
when trying to determine if the *types* are equal, so change __eq__ to
look at the max_length and schemes, which do describe the type instead
of an instance of a URL.

Since the value property is not used for anything else, it is marked
deprecated so we can remove it in a future version.

Change-Id: Ia5ba7d13a0b46b357c9225d4f71f770642c14f61
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-04-20 17:04:07 -04:00
Moises Guimaraes de Medeiros
0fbd3efbca Fix HostAddress superclass.
All the other types inherit from ConfigType.

Change-Id: I4905cf0cfac6343d4e2cc43f97d5600062c5ef37
Signed-off-by: Moises Guimaraes de Medeiros <moguimar@redhat.com>
2018-04-20 10:12:38 +02:00
Doug Hellmann
7db6a2604d use environment variable to control file location probing
If OSLO_CONFIG_SHOW_CODE_LOCATIONS is set to any non-empty string it
will turn on the ability to see which file has the definition of an
Opt or where set_default() was invoked.

Change-Id: Ie705014dcf331e3c6b3367d2fefbfb9acc091799
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-04-18 12:26:44 -04:00
Stephen Finucane
0e70c4c0d8 sphinxext: Use 'sphinx.util.logging'
This resolves a deprecation warning. It also allows us to stop passing
around the 'app' variable just to enable logging.

Change-Id: I7b7e29ae6dec086373bbaeb2ebaae5ed7e9628b1
2018-04-16 17:07:45 +01:00
Zuul
84655714b6 Merge "Make List option format bounds-sensitive" 6.1.0 2018-04-16 03:04:09 +00:00
Doug Hellmann
8f97bdb646 set default python to python3
Set the default python to python3 except for the py27 environment. We
have to set that explicitly to override the new default.

Change-Id: Ief7f053de13287bc3c1032870c255be4b880d172
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-04-12 15:56:56 -04:00
Ben Nemec
f95a6ff35e Switch pep8 job to python 3
pep8 under python 3 is more strict than under python 2, so to make
sure our projects meet the more strict standards we want to run the
pep8 jobs using python 3 by default.

Change-Id: If3016aef3a75281ff9edb5615bbc4575e6214e9e
2018-04-12 16:42:21 +00:00
Zuul
f1a63a3e78 Merge "sphinxext: Start parsing 'Opt.help' as rST" 2018-04-12 15:18:22 +00:00
Brian Rosmaita
a69701c495 Make List option format bounds-sensitive
The List ConfigType has a boolean 'bounds' option that indicates
whether the value must be enclosed in brackets.  This patch modifies
the List formatter so that when bounds=True the output is displayed
in enclosing brackets.

Change-Id: Ide3748e67d14191b6b33c97c7d8437e4888e61d5
Closes-bug: #1763239
2018-04-11 22:51:49 -04:00
Zuul
dfcad40005 Merge "Add bindep.txt file to prevent fallback to generic list" 2018-04-11 10:42:24 +00:00
Zuul
0aedd36684 Merge "Clean old output before new doc builds" 2018-04-10 20:43:31 +00:00
Zuul
d23a976d42 Merge "sphinxext: Separate parsing of group and opts" 2018-04-07 12:27:26 +00:00
Moises Guimaraes de Medeiros
25f6fd8814 Fix typo 'importopt' to 'import_opt' adding the missing _
Change-Id: I948a46c3927c88d99c0608fec5f5e187f74f827f
Signed-off-by: Moises Guimaraes de Medeiros <moguimar@redhat.com>
2018-04-06 17:47:17 +02:00
Zuul
25e86a9f3f Merge "ignore location when comparing options for duplicate registration" 2018-04-04 09:42:39 +00:00
Doug Hellmann
b6cfa29055 disable stack inspection when setting option values
Inspecting the stack every time we create an Opt or call
set_defaults() is too expensive. This patch disables it but leaves the
code in place to make it easier for someone else to come along and
work on the performance issue without having to revert the patch
completely.

Change-Id: I25bd71ffa49f4232972370a35bf9040e7c45bf70
Addresses-Bug: #1759689
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-03-28 19:02:49 -04:00