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>
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
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>
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
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>
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>
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>
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>
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
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
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
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>
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>
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>
Creates and abstract base class for configuration sources
to be implemented off of.
Change-Id: I238930df61749a77b0a0aa4f033375972a159931
Blueprint: oslo-config-drivers
Create a base class to support a configuration driver for Oslo.config
Change-Id: Idec1456c00dedb8c3628cbc4a934b870cd8dc7fc
Patially-Implements: blueprint oslo-config-db
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>
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
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
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>
All the other types inherit from ConfigType.
Change-Id: I4905cf0cfac6343d4e2cc43f97d5600062c5ef37
Signed-off-by: Moises Guimaraes de Medeiros <moguimar@redhat.com>
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>
This resolves a deprecation warning. It also allows us to stop passing
around the 'app' variable just to enable logging.
Change-Id: I7b7e29ae6dec086373bbaeb2ebaae5ed7e9628b1
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>
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
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
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>