Hello community, here is the log from the commit of package python-oslo.config for openSUSE:Factory checked in at 2020-02-18 10:40:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-oslo.config (Old) and /work/SRC/openSUSE:Factory/.python-oslo.config.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-oslo.config" Tue Feb 18 10:40:50 2020 rev:31 rq:774910 version:6.11.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-oslo.config/python-oslo.config.changes 2019-05-03 22:42:10.743210200 +0200 +++ /work/SRC/openSUSE:Factory/.python-oslo.config.new.26092/python-oslo.config.changes 2020-02-18 10:41:29.853078205 +0100 @@ -1,0 +2,31 @@ +Wed Oct 9 12:25:30 UTC 2019 - [email protected] + +- update to version 6.11.1 + - Move user docs to top of index + - Switch to sphinxcontrib-apidoc + - Update master for stable/stein + - Add unit tests for validator + - OpenDev Migration Patch + - Deprecate ConfigFilter + - Cap Bandit below 1.6.0 and update Sphinx requirement + - Revert "Replace git.openstack.org URLs with opendev.org URLs" + - Clean up the unnecessary sphinx from test-requirements.txt + - Add note to docs about CLI opts and config files + - Blacklist sphinx 2.1.0 (autodoc bug) + - Handle collections.abc deprecations + - Document precedence of config sources + - tox: Suppress output + - Add exclude-groups option to config validator + - Dropping the py35 testing + - Replace git.openstack.org URLs with opendev.org URLs + - Improve removing quotes logic + - Clarify help on config-file and config-dir options + - Add a Quick Start tutorial + - tox: Whitelist 'find' + - Add special handling for keystone_authtoken group + - Fix coverage tox venv + - Remove '.testr.conf' + - Add Python 3 Train unit tests + - Bump the openstackdocstheme extension to 1.20 + +------------------------------------------------------------------- Old: ---- oslo.config-6.8.1.tar.gz New: ---- oslo.config-6.11.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-oslo.config.spec ++++++ --- /var/tmp/diff_new_pack.4KowWF/_old 2020-02-18 10:41:30.557079641 +0100 +++ /var/tmp/diff_new_pack.4KowWF/_new 2020-02-18 10:41:30.585079699 +0100 @@ -17,15 +17,14 @@ Name: python-oslo.config -Version: 6.8.1 +Version: 6.11.1 Release: 0 Summary: OpenStack common configuration library License: Apache-2.0 Group: Development/Languages/Python URL: https://launchpad.net/oslo.config -Source0: https://files.pythonhosted.org/packages/source/o/oslo.config/oslo.config-6.8.1.tar.gz +Source0: https://files.pythonhosted.org/packages/source/o/oslo.config/oslo.config-6.11.1.tar.gz BuildRequires: openstack-macros -BuildRequires: python-devel BuildRequires: python2-PyYAML >= 3.12 BuildRequires: python2-debtcollector >= 1.2.0 BuildRequires: python2-fixtures @@ -38,13 +37,12 @@ BuildRequires: python2-requests-mock BuildRequires: python2-rfc3986 >= 1.2.0 BuildRequires: python2-six >= 1.10.0 +BuildRequires: python2-stestr BuildRequires: python2-stevedore >= 1.20.0 -BuildRequires: python2-testrepository BuildRequires: python2-testscenarios BuildRequires: python2-testtools BuildRequires: python3-PyYAML >= 3.12 BuildRequires: python3-debtcollector >= 1.2.0 -BuildRequires: python3-devel BuildRequires: python3-fixtures BuildRequires: python3-mock BuildRequires: python3-netaddr >= 0.7.18 @@ -55,8 +53,8 @@ BuildRequires: python3-requests-mock BuildRequires: python3-rfc3986 >= 1.2.0 BuildRequires: python3-six >= 1.10.0 +BuildRequires: python3-stestr BuildRequires: python3-stevedore >= 1.20.0 -BuildRequires: python3-testrepository BuildRequires: python3-testscenarios BuildRequires: python3-testtools Requires: python-PyYAML >= 3.12 @@ -94,21 +92,23 @@ %package -n python-oslo.config-doc Summary: Documentation for OpenStack common configuration library Group: Development/Languages/Python -BuildRequires: python-Sphinx -BuildRequires: python-openstackdocstheme +BuildRequires: python2-Sphinx +BuildRequires: python3-Sphinx +BuildRequires: python3-openstackdocstheme +BuildRequires: python3-sphinxcontrib-apidoc %description -n python-oslo.config-doc Documentation for the oslo-config library. %prep -%autosetup -p1 -n oslo.config-6.8.1 +%autosetup -p1 -n oslo.config-6.11.1 %py_req_cleanup %build %{python_build} -PBR_VERSION=6.8.1 PYTHONPATH=. \ - sphinx-build -b html doc/source doc/build/html +PBR_VERSION=6.11.1 PYTHONPATH=. \ + %sphinx_build -b html doc/source doc/build/html # remove the sphinx-build leftovers rm -rf doc/build/html/.{doctrees,buildinfo} @@ -126,9 +126,7 @@ %check # Requires oslo.log which we can't depend on for build cycle reasons rm -v oslo_config/tests/test_cfg.py -%{python_expand rm -rf .testrepository -$python setup.py testr -} +%python_exec -m stestr.cli run %files %{python_files} %license LICENSE ++++++ _service ++++++ --- /var/tmp/diff_new_pack.4KowWF/_old 2020-02-18 10:41:30.665079861 +0100 +++ /var/tmp/diff_new_pack.4KowWF/_new 2020-02-18 10:41:30.665079861 +0100 @@ -1,8 +1,8 @@ <services> <service mode="disabled" name="renderspec"> - <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/stein/openstack/oslo.config/oslo.config.spec.j2</param> + <param name="input-template">https://raw.githubusercontent.com/openstack/rpm-packaging/stable/train/openstack/oslo.config/oslo.config.spec.j2</param> <param name="output-name">python-oslo.config.spec</param> - <param name="requirements">https://raw.githubusercontent.com/openstack/oslo.config/stable/stein/requirements.txt</param> + <param name="requirements">https://raw.githubusercontent.com/openstack/oslo.config/stable/train/requirements.txt</param> <param name="changelog-email">[email protected]</param> <param name="changelog-provider">gh,openstack,oslo.config</param> </service> ++++++ oslo.config-6.8.1.tar.gz -> oslo.config-6.11.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/.testr.conf new/oslo.config-6.11.1/.testr.conf --- old/oslo.config-6.8.1/.testr.conf 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/.testr.conf 1970-01-01 01:00:00.000000000 +0100 @@ -1,4 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_TEST_TIMEOUT=60 ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/.zuul.d/project.yaml new/oslo.config-6.11.1/.zuul.d/project.yaml --- old/oslo.config-6.8.1/.zuul.d/project.yaml 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/.zuul.d/project.yaml 2019-08-29 11:45:05.000000000 +0200 @@ -5,9 +5,7 @@ - lib-forward-testing-python3 - openstack-lower-constraints-jobs - openstack-python-jobs - - openstack-python35-jobs - - openstack-python36-jobs - - openstack-python37-jobs + - openstack-python3-train-jobs - periodic-stable-jobs - publish-openstack-docs-pti - release-notes-jobs-python3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/AUTHORS new/oslo.config-6.11.1/AUTHORS --- old/oslo.config-6.8.1/AUTHORS 2019-02-28 19:03:10.000000000 +0100 +++ new/oslo.config-6.11.1/AUTHORS 2019-08-29 11:45:52.000000000 +0200 @@ -9,6 +9,7 @@ Andreas Jaeger <[email protected]> Andreas Jaeger <[email protected]> Andrey Volkov <[email protected]> +Andrii Ostapenko <[email protected]> Anthony Young <[email protected]> Atsushi SAKAI <[email protected]> BaoLiang Cui <[email protected]> @@ -50,6 +51,7 @@ Eoghan Glynn <[email protected]> Eric Brown <[email protected]> Eric Fried <[email protected]> +Eric Fried <[email protected]> Eric Guo <[email protected]> Eric Harney <[email protected]> Fengqian.Gao <[email protected]> @@ -57,6 +59,7 @@ Flavio Percoco <[email protected]> Gary Kotton <[email protected]> Gevorg Davoian <[email protected]> +Ghanshyam Mann <[email protected]> Giampaolo Lauria <[email protected]> Hemanth Makkapati <[email protected]> Hervé Beraud <[email protected]> @@ -140,6 +143,7 @@ Shane Wang <[email protected]> Stephen Finucane <[email protected]> Stephen Finucane <[email protected]> +Stephen Finucane <[email protected]> Steven Deaton <[email protected]> Swapnil Kulkarni (coolsvap) <[email protected]> Takashi NATSUME <[email protected]> @@ -172,16 +176,19 @@ avnish <[email protected]> bhavani.cr <[email protected]> blue55 <[email protected]> +caoyuan <[email protected]> chenxing <[email protected]> gengchc2 <[email protected]> hnyang <[email protected]> howardlee <[email protected]> +jacky06 <[email protected]> liu-sheng <[email protected]> liyingjun <[email protected]> llg8212 <[email protected]> loooosy <[email protected]> lzyeval <[email protected]> melissaml <[email protected]> +pengyuesheng <[email protected]> ricolin <[email protected]> shangxiaobj <[email protected]> skudriashev <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/ChangeLog new/oslo.config-6.11.1/ChangeLog --- old/oslo.config-6.8.1/ChangeLog 2019-02-28 19:03:10.000000000 +0100 +++ new/oslo.config-6.11.1/ChangeLog 2019-08-29 11:45:52.000000000 +0200 @@ -1,6 +1,48 @@ CHANGES ======= +6.11.1 +------ + +* Improve removing quotes logic +* Bump the openstackdocstheme extension to 1.20 +* Blacklist sphinx 2.1.0 (autodoc bug) +* Clean up the unnecessary sphinx from test-requirements.txt +* Add Python 3 Train unit tests + +6.11.0 +------ + +* Remove '.testr.conf' +* Switch to sphinxcontrib-apidoc +* Deprecate ConfigFilter +* Add unit tests for validator + +6.10.0 +------ + +* Fix coverage tox venv +* Add special handling for keystone\_authtoken group +* Cap Bandit below 1.6.0 and update Sphinx requirement +* Add a Quick Start tutorial +* Revert "Replace git.openstack.org URLs with opendev.org URLs" +* Document precedence of config sources +* Replace git.openstack.org URLs with opendev.org URLs +* Move user docs to top of index + +6.9.0 +----- + +* OpenDev Migration Patch +* Dropping the py35 testing +* tox: Suppress output +* Clarify help on config-file and config-dir options +* Handle collections.abc deprecations +* Add exclude-groups option to config validator +* Update master for stable/stein +* Add note to docs about CLI opts and config files +* tox: Whitelist 'find' + 6.8.1 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/PKG-INFO new/oslo.config-6.11.1/PKG-INFO --- old/oslo.config-6.8.1/PKG-INFO 2019-02-28 19:03:10.000000000 +0100 +++ new/oslo.config-6.11.1/PKG-INFO 2019-08-29 11:45:52.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: oslo.config -Version: 6.8.1 +Version: 6.11.1 Summary: Oslo Configuration API Home-page: https://docs.openstack.org/oslo.config/latest/ Author: OpenStack @@ -48,4 +48,5 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/requirements.txt new/oslo.config-6.11.1/doc/requirements.txt --- old/oslo.config-6.8.1/doc/requirements.txt 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/requirements.txt 2019-08-29 11:45:05.000000000 +0200 @@ -2,8 +2,10 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD -openstackdocstheme>=1.18.1 # Apache-2.0 +sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD +sphinx!=1.6.6,!=1.6.7,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD +sphinxcontrib-apidoc>=0.2.0 # BSD +openstackdocstheme>=1.20.0 # Apache-2.0 reno>=2.5.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD doc8>=0.6.0 # Apache-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/cli/generator.rst new/oslo.config-6.11.1/doc/source/cli/generator.rst --- old/oslo.config-6.8.1/doc/source/cli/generator.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/cli/generator.rst 2019-08-29 11:45:05.000000000 +0200 @@ -289,7 +289,7 @@ the ``OptGroup`` they are assigned to which defaults to ``DEFAULT`` if unset. For information on the various attributes of each option, refer to - :ref:`option-definitions`. + :class:`oslo_config.cfg.Opt` and its subclasses. ``deprecated_options`` @@ -358,12 +358,3 @@ cfg.StrOpt('base_dir' default=os.getcwd(), sample_default='/usr/lib/myapp') - -API ---- - -.. currentmodule:: oslo_config.generator - -.. autofunction:: main -.. autofunction:: generate -.. autofunction:: register_cli_opts diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/cli/validator.rst new/oslo.config-6.11.1/doc/source/cli/validator.rst --- old/oslo.config-6.8.1/doc/source/cli/validator.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/cli/validator.rst 2019-08-29 11:45:05.000000000 +0200 @@ -28,15 +28,17 @@ ``--input-file`` should point at the location of the configuration file to be validated. -Here's an example of using the validator on Nova as installed by Devstack:: +Here's an example of using the validator on Nova as installed by Devstack (with +the option [foo]/bar added to demonstrate a failure):: $ oslo-config-validator --config-file /opt/stack/nova/etc/nova/nova-config-generator.conf --input-file /etc/nova/nova.conf - ERROR:root:keystone_authtoken/user_domain_name not found - ERROR:root:keystone_authtoken/password not found - ERROR:root:keystone_authtoken/project_domain_name not found - ERROR:root:keystone_authtoken/project_name not found - ERROR:root:keystone_authtoken/username not found - ERROR:root:keystone_authtoken/auth_url not found + ERROR:root:foo/bar not found + INFO:root:Ignoring missing option "project_domain_name" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + INFO:root:Ignoring missing option "project_name" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + INFO:root:Ignoring missing option "user_domain_name" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + INFO:root:Ignoring missing option "password" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + INFO:root:Ignoring missing option "username" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + INFO:root:Ignoring missing option "auth_url" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. Machine-Readable Sample Config ------------------------------ @@ -52,12 +54,27 @@ config file to validated in ``--input-file`` as above. Here's an example of using the validator on Nova as installed by Devstack, with -a sample config file ``config-data.yaml`` created by the config generator:: +a sample config file ``config-data.yaml`` created by the config generator (with +the option [foo]/bar added to demonstrate a failure):: $ oslo-config-validator --opt-data config-data.yaml --input-file /etc/nova/nova.conf - ERROR:root:keystone_authtoken/username not found - ERROR:root:keystone_authtoken/project_domain_name not found - ERROR:root:keystone_authtoken/user_domain_name not found - ERROR:root:keystone_authtoken/project_name not found - ERROR:root:keystone_authtoken/password not found - ERROR:root:keystone_authtoken/auth_url not found + ERROR:root:foo/bar not found + INFO:root:Ignoring missing option "project_domain_name" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + INFO:root:Ignoring missing option "project_name" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + INFO:root:Ignoring missing option "user_domain_name" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + INFO:root:Ignoring missing option "password" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + INFO:root:Ignoring missing option "username" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + INFO:root:Ignoring missing option "auth_url" from group "keystone_authtoken" because the group is known to have incomplete sample config data and thus cannot be validated properly. + +Handling Dynamic Groups +----------------------- + +Some services register group names dynamically at runtime based on other +configuration. This is problematic for the validator because these groups won't +be present in the sample config data. The ``--exclude-group`` option for the +validator can be used to ignore such groups and allow the other options in a +config file to be validated normally. + +.. note:: The ``keystone_authtoken`` group is always ignored because of the + unusual way the options from that library are generated. The sample + configuration data is known to be incomplete as a result. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/conf.py new/oslo.config-6.11.1/doc/source/conf.py --- old/oslo.config-6.8.1/doc/source/conf.py 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/conf.py 2019-08-29 11:45:05.000000000 +0200 @@ -13,13 +13,13 @@ 'openstackdocstheme', 'oslo_config.sphinxconfiggen', 'oslo_config.sphinxext', + 'sphinxcontrib.apidoc', ] # openstackdocstheme options repository_name = 'openstack/oslo.config' bug_project = 'oslo.config' bug_tag = '' -html_last_updated_fmt = '%Y-%m-%d %H:%M' config_generator_config_file = 'config-generator.conf' @@ -37,7 +37,6 @@ master_doc = 'index' # General information about the project. -project = u'oslo.config' copyright = u'2013, OpenStack Foundation' # If true, '()' will be appended to :func: etc. cross-reference text. @@ -63,15 +62,10 @@ # html_static_path = ['static'] html_theme = 'openstackdocs' -# Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project +# -- sphinxcontrib.apidoc configuration -------------------------------------- -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass -# [howto/manual]). -latex_documents = [ - ('index', - '%s.tex' % project, - '%s Documentation' % project, - 'OpenStack Foundation', 'manual'), +apidoc_module_dir = '../../oslo_config' +apidoc_output_dir = 'reference/api' +apidoc_excluded_paths = [ + 'tests', ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/configuration/index.rst new/oslo.config-6.11.1/doc/source/configuration/index.rst --- old/oslo.config-6.8.1/doc/source/configuration/index.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/configuration/index.rst 2019-08-29 11:45:05.000000000 +0200 @@ -5,6 +5,7 @@ .. toctree:: :maxdepth: 2 + quickstart format mutable options diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/configuration/options.rst new/oslo.config-6.11.1/doc/source/configuration/options.rst --- old/oslo.config-6.8.1/doc/source/configuration/options.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/configuration/options.rst 2019-08-29 11:45:05.000000000 +0200 @@ -2,6 +2,23 @@ Configuration Options from oslo.config ======================================== +When loading values from the sources defined by the following options, the +precedence is as follows: + +#. Command Line +#. Environment Variables +#. Config Files from ``--config-dir`` [1]_ +#. Config Files from ``--config-file`` +#. Pluggable Config Sources + +If a value is specified in multiple locations, the location used will be the +one higher in the list. For example, if a value is specified both on the +command line and in an environment variable, the value from the command line +will be the one returned. + +.. [1] Files in a config dir are parsed in alphabetical order. Later files + take precedence over earlier ones. + .. show-options:: oslo.config diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/configuration/quickstart.rst new/oslo.config-6.11.1/doc/source/configuration/quickstart.rst --- old/oslo.config-6.8.1/doc/source/configuration/quickstart.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/configuration/quickstart.rst 2019-08-29 11:45:05.000000000 +0200 @@ -0,0 +1,78 @@ +========================== + oslo.config Quick Start! +========================== + +Are you brand new to oslo.config? This brief tutorial will get you started +understanding some of the fundamentals. + +Prerequisites +------------- +* A plain text editor or Python-enabled IDE +* A Python interpreter +* A command shell from which the interpreter can be invoked +* The oslo_config library in your Python path. + +Test Script +----------- +Put this in a file called ``oslocfgtest.py``. + +.. code:: python + + # The sys module lets you get at the command line arguments. + import sys + + # Load up the cfg module, which contains all the classes and methods + # you'll need. + from oslo_config import cfg + + # Define an option group + grp = cfg.OptGroup('mygroup') + + # Define a couple of options + opts = [cfg.StrOpt('option1'), + cfg.IntOpt('option2', default=42)] + + # Register your config group + cfg.CONF.register_group(grp) + + # Register your options within the config group + cfg.CONF.register_opts(opts, group=grp) + + # Process command line arguments. The arguments tell CONF where to + # find your config file, which it loads and parses to populate itself. + cfg.CONF(sys.argv[1:]) + + # Now you can access the values from the config file as + # CONF.<group>.<opt> + print("The value of option1 is %s" % cfg.CONF.mygroup.option1) + print("The value of option2 is %d" % cfg.CONF.mygroup.option2) + +Conf File +--------- +Put this in a file called ``oslocfgtest.conf`` in the same directory as +``oslocfgtest.py``. + +.. code:: ini + + [mygroup] + option1 = foo + # Comment out option2 to test the default value + # option2 = 123 + +Run It! +------- +From your command shell, in the same directory as your script and conf, invoke: + +.. code:: shell + + python oslocfgtest.py --config-file oslocfgtest.conf + +Revel in the output being exactly as expected. If you've done everything +right, you should see: + +.. code:: shell + + The value of option1 is foo + The value of option2 is 42 + +Now go play with some more advanced option settings! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/index.rst new/oslo.config-6.11.1/doc/source/index.rst --- old/oslo.config-6.8.1/doc/source/index.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/index.rst 2019-08-29 11:45:05.000000000 +0200 @@ -11,9 +11,9 @@ .. toctree:: :maxdepth: 2 + configuration/index reference/index cli/index - configuration/index contributor/index Indices and tables diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/cfgfilter.rst new/oslo.config-6.11.1/doc/source/reference/cfgfilter.rst --- old/oslo.config-6.8.1/doc/source/reference/cfgfilter.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/cfgfilter.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ --------------------- -The cfgfilter Module --------------------- - -.. automodule:: oslo_config.cfgfilter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/configopts.rst new/oslo.config-6.11.1/doc/source/reference/configopts.rst --- old/oslo.config-6.8.1/doc/source/reference/configopts.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/configopts.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ --------------------- -The ConfigOpts Class --------------------- - -.. currentmodule:: oslo_config.cfg - -.. autoclass:: ConfigOpts - :members: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/configuration-files.rst new/oslo.config-6.11.1/doc/source/reference/configuration-files.rst --- old/oslo.config-6.8.1/doc/source/reference/configuration-files.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/configuration-files.rst 2019-08-29 11:45:05.000000000 +0200 @@ -42,7 +42,10 @@ Later values always override earlier ones. The order of configuration files inside the same configuration directory is -defined by the alphabetic sorting order of their file names. +defined by the alphabetic sorting order of their file names. Files in a +configuration directory are parsed after any individual configuration files, +so values that appear in both a configuration file and configuration directory +will use the value from the directory. The parsing of CLI args and config files is initiated by invoking the config manager for example: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/defining.rst new/oslo.config-6.11.1/doc/source/reference/defining.rst --- old/oslo.config-6.8.1/doc/source/reference/defining.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/defining.rst 2019-08-29 11:45:05.000000000 +0200 @@ -112,7 +112,11 @@ An option may optionally be made available via the command line. Such options must be registered with the config manager before the command line is parsed -(for the purposes of --help and CLI arg validation): +(for the purposes of --help and CLI arg validation). + +Note that options registered for CLI use do not need to be registered again for +use from other config sources, such as files. CLI options can be read from +either the CLI or from the other enabled config sources. .. code-block:: python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/drivers.rst new/oslo.config-6.11.1/doc/source/reference/drivers.rst --- old/oslo.config-6.8.1/doc/source/reference/drivers.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/drivers.rst 2019-08-29 11:45:05.000000000 +0200 @@ -3,11 +3,14 @@ Backend Drivers --------------- -.. automodule:: oslo_config.sources +Refer to :py:mod:`oslo_config.sources` Known Backend Drivers --------------------- +.. NOTE(bnemec): These are private modules, so we need to explicitly + document them + .. automodule:: oslo_config.sources._uri .. automodule:: oslo_config.sources._environment diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/exceptions.rst new/oslo.config-6.11.1/doc/source/reference/exceptions.rst --- old/oslo.config-6.8.1/doc/source/reference/exceptions.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/exceptions.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,20 +0,0 @@ ----------- -Exceptions ----------- - -.. currentmodule:: oslo_config.cfg - -.. autoexception:: Error -.. autoexception:: NotInitializedError -.. autoexception:: ArgsAlreadyParsedError -.. autoexception:: NoSuchOptError -.. autoexception:: NoSuchGroupError -.. autoexception:: DuplicateOptError -.. autoexception:: RequiredOptError -.. autoexception:: TemplateSubstitutionError -.. autoexception:: ConfigFilesNotFoundError -.. autoexception:: ConfigFilesPermissionDeniedError -.. autoexception:: ConfigDirNotFoundError -.. autoexception:: ConfigFileParseError -.. autoexception:: ConfigFileValueError -.. autoexception:: DefaultValueError diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/fixture.rst new/oslo.config-6.11.1/doc/source/reference/fixture.rst --- old/oslo.config-6.8.1/doc/source/reference/fixture.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/fixture.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ ------------- -Test Fixture ------------- - -.. currentmodule:: oslo_config.fixture - -.. autoclass:: Config - :members: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/helpers.rst new/oslo.config-6.11.1/doc/source/reference/helpers.rst --- old/oslo.config-6.8.1/doc/source/reference/helpers.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/helpers.rst 2019-08-29 11:45:05.000000000 +0200 @@ -2,11 +2,6 @@ Helper Functions ---------------- -.. currentmodule:: oslo_config.cfg - -.. autofunction:: find_config_files -.. autofunction:: set_defaults - Showing detailed locations for configuration settings ----------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/index.rst new/oslo.config-6.11.1/doc/source/reference/index.rst --- old/oslo.config-6.8.1/doc/source/reference/index.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/index.rst 2019-08-29 11:45:05.000000000 +0200 @@ -5,6 +5,7 @@ .. toctree:: :maxdepth: 2 + API <api/modules> defining naming accessing @@ -12,14 +13,7 @@ command-line deprecating globals - opts - types - configopts - cfgfilter helpers - fixture - parser - exceptions styleguide mutable locations diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/opts.rst new/oslo.config-6.11.1/doc/source/reference/opts.rst --- old/oslo.config-6.8.1/doc/source/reference/opts.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/opts.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -.. _option-definitions: - -==================== - Opt and Subclasses -==================== - -.. currentmodule:: oslo_config.cfg - -.. autoclass:: Opt -.. autoclass:: StrOpt -.. autoclass:: BoolOpt -.. autoclass:: IntOpt -.. autoclass:: FloatOpt -.. autoclass:: ListOpt -.. autoclass:: DictOpt -.. autoclass:: MultiOpt -.. autoclass:: MultiStrOpt -.. autoclass:: IPOpt -.. autoclass:: PortOpt -.. autoclass:: HostnameOpt -.. autoclass:: HostAddressOpt -.. autoclass:: URIOpt -.. autoclass:: DeprecatedOpt -.. autoclass:: SubCommandOpt -.. autoclass:: OptGroup diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/parser.rst new/oslo.config-6.11.1/doc/source/reference/parser.rst --- old/oslo.config-6.8.1/doc/source/reference/parser.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/parser.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ ------------- -File Parsing ------------- - -.. autoclass:: oslo_config.iniparser.BaseParser - -.. autoclass:: oslo_config.cfg.ConfigParser - :members: parse diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/doc/source/reference/types.rst new/oslo.config-6.11.1/doc/source/reference/types.rst --- old/oslo.config-6.8.1/doc/source/reference/types.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/doc/source/reference/types.rst 1970-01-01 01:00:00.000000000 +0100 @@ -1,6 +0,0 @@ -============================= - Option Types and Validation -============================= - -.. automodule:: oslo_config.types - :members: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/lower-constraints.txt new/oslo.config-6.11.1/lower-constraints.txt --- old/oslo.config-6.8.1/lower-constraints.txt 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/lower-constraints.txt 2019-08-29 11:45:05.000000000 +0200 @@ -20,10 +20,10 @@ linecache2==1.0.0 MarkupSafe==1.0 mccabe==0.2.1 -mock==2.0.0 +mock==3.0.0 mox3==0.20.0 netaddr==0.7.18 -openstackdocstheme==1.18.1 +openstackdocstheme==1.20.0 os-client-config==1.28.0 oslo.i18n==3.15.3 oslo.log==3.36.0 @@ -46,7 +46,7 @@ snowballstemmer==1.2.1 Sphinx==1.6.2 sphinxcontrib-websupport==1.0.1 -stestr==2.0.0 +stestr==2.1.0 stevedore==1.20.0 testscenarios==0.4 testtools==2.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/oslo.config.egg-info/PKG-INFO new/oslo.config-6.11.1/oslo.config.egg-info/PKG-INFO --- old/oslo.config-6.8.1/oslo.config.egg-info/PKG-INFO 2019-02-28 19:03:10.000000000 +0100 +++ new/oslo.config-6.11.1/oslo.config.egg-info/PKG-INFO 2019-08-29 11:45:52.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: oslo.config -Version: 6.8.1 +Version: 6.11.1 Summary: Oslo Configuration API Home-page: https://docs.openstack.org/oslo.config/latest/ Author: OpenStack @@ -48,4 +48,5 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/oslo.config.egg-info/SOURCES.txt new/oslo.config-6.11.1/oslo.config.egg-info/SOURCES.txt --- old/oslo.config-6.8.1/oslo.config.egg-info/SOURCES.txt 2019-02-28 19:03:10.000000000 +0100 +++ new/oslo.config-6.11.1/oslo.config.egg-info/SOURCES.txt 2019-08-29 11:45:52.000000000 +0200 @@ -1,6 +1,5 @@ .coveragerc .stestr.conf -.testr.conf AUTHORS CONTRIBUTING.rst ChangeLog @@ -26,30 +25,24 @@ doc/source/configuration/index.rst doc/source/configuration/mutable.rst doc/source/configuration/options.rst +doc/source/configuration/quickstart.rst doc/source/contributor/index.rst doc/source/reference/accessing.rst -doc/source/reference/cfgfilter.rst doc/source/reference/command-line.rst -doc/source/reference/configopts.rst doc/source/reference/configuration-files.rst doc/source/reference/defining.rst doc/source/reference/deprecating.rst doc/source/reference/drivers.rst -doc/source/reference/exceptions.rst doc/source/reference/faq.rst -doc/source/reference/fixture.rst doc/source/reference/globals.rst doc/source/reference/helpers.rst doc/source/reference/index.rst doc/source/reference/locations.rst doc/source/reference/mutable.rst doc/source/reference/naming.rst -doc/source/reference/opts.rst -doc/source/reference/parser.rst doc/source/reference/sphinxconfiggen.rst doc/source/reference/sphinxext.rst doc/source/reference/styleguide.rst -doc/source/reference/types.rst oslo.config.egg-info/PKG-INFO oslo.config.egg-info/SOURCES.txt oslo.config.egg-info/dependency_links.txt @@ -86,6 +79,7 @@ oslo_config/tests/test_sphinxconfiggen.py oslo_config/tests/test_sphinxext.py oslo_config/tests/test_types.py +oslo_config/tests/test_validator.py oslo_config/tests/testmods/__init__.py oslo_config/tests/testmods/bar_foo_opt.py oslo_config/tests/testmods/baz_qux_opt.py @@ -105,6 +99,7 @@ releasenotes/notes/show-deprecated-reason-361a8eb31e05c97e.yaml releasenotes/notes/support-choice-descriptions-8b2d0c14fbd16b2a.yaml releasenotes/notes/support-fatal-deprecations-ea0513aa58a395ca.yaml +releasenotes/notes/validator-exclude-groups-ad2f046522a3407e.yaml releasenotes/source/conf.py releasenotes/source/index.rst releasenotes/source/liberty.rst @@ -114,6 +109,7 @@ releasenotes/source/pike.rst releasenotes/source/queens.rst releasenotes/source/rocky.rst +releasenotes/source/stein.rst releasenotes/source/unreleased.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholder \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/oslo.config.egg-info/pbr.json new/oslo.config-6.11.1/oslo.config.egg-info/pbr.json --- old/oslo.config-6.8.1/oslo.config.egg-info/pbr.json 2019-02-28 19:03:10.000000000 +0100 +++ new/oslo.config-6.11.1/oslo.config.egg-info/pbr.json 2019-08-29 11:45:52.000000000 +0200 @@ -1 +1 @@ -{"git_version": "fd4c1a0", "is_release": true} \ No newline at end of file +{"git_version": "c4d8fa7", "is_release": true} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/oslo_config/cfg.py new/oslo.config-6.11.1/oslo_config/cfg.py --- old/oslo.config-6.8.1/oslo_config/cfg.py 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/oslo_config/cfg.py 2019-08-29 11:45:05.000000000 +0200 @@ -17,6 +17,14 @@ import argparse import collections + +# TODO(smcginnis) update this once six has support for collections.abc +# (https://github.com/benjaminp/six/pull/241) or clean up once we drop py2.7. +try: + from collections.abc import Mapping +except ImportError: + from collections import Mapping + import copy import errno import functools @@ -1910,7 +1918,7 @@ super(_CachedArgumentParser, self).print_usage(file) -class ConfigOpts(collections.Mapping): +class ConfigOpts(Mapping): """Config options which may be set on the command line or in config files. @@ -1995,7 +2003,8 @@ help=('Path to a config file to use. Multiple ' 'config files can be specified, with values ' 'in later files taking precedence. Defaults ' - 'to %(default)s.')), + 'to %(default)s. This option must be set ' + 'from the command-line.')), _ConfigDirOpt('config-dir', metavar='DIR', default=default_config_dirs, @@ -2006,7 +2015,8 @@ 'is parsed after the file(s) specified via ' 'previous --config-file, arguments hence ' 'over-ridden options in the directory take ' - 'precedence.'), + 'precedence. This option must be set from ' + 'the command-line.'), ] @classmethod @@ -3099,7 +3109,7 @@ value, loc = self._do_get(name, opt_group, None) return loc - class GroupAttr(collections.Mapping): + class GroupAttr(Mapping): """Helper class. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/oslo_config/cfgfilter.py new/oslo.config-6.11.1/oslo_config/cfgfilter.py --- old/oslo.config-6.8.1/oslo_config/cfgfilter.py 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/oslo_config/cfgfilter.py 2019-08-29 11:45:05.000000000 +0200 @@ -13,6 +13,9 @@ # under the License. r""" +DEPRECATED: This module is deprecated and scheduled for removal in the +U cycle. + There are three use cases for the ConfigFilter class: 1. Help enforce that a given module does not access options registered @@ -128,9 +131,12 @@ import collections import itertools +from debtcollector import removals + from oslo_config import cfg [email protected]_class('CliOptRegisteredError') class CliOptRegisteredError(cfg.Error): """Raised when registering cli opt not in original ConfigOpts. @@ -146,6 +152,7 @@ return ret [email protected]_class('ConfigFilter') class ConfigFilter(collections.Mapping): """A helper class which wraps a ConfigOpts object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/oslo_config/sphinxext.py new/oslo.config-6.11.1/oslo_config/sphinxext.py --- old/oslo.config-6.8.1/oslo_config/sphinxext.py 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/oslo_config/sphinxext.py 2019-08-29 11:45:05.000000000 +0200 @@ -474,6 +474,7 @@ def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): + """Resolve cross-references""" if typ == 'option': group_name, option_name = target.split('.', 1) return make_refnode( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/oslo_config/tests/test_types.py new/oslo.config-6.11.1/oslo_config/tests/test_types.py --- old/oslo.config-6.8.1/oslo_config/tests/test_types.py 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/oslo_config/tests/test_types.py 2019-08-29 11:45:05.000000000 +0200 @@ -93,6 +93,11 @@ self.type_instance = types.String(quotes=True) self.assertConvertedValue('foo bar"', 'foo bar"') + def test_single_quote_is_invalid(self): + self.type_instance = types.String(quotes=True) + self.assertInvalid('"') + self.assertInvalid("'") + def test_repr(self): t = types.String() self.assertEqual('String', repr(t)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/oslo_config/tests/test_validator.py new/oslo.config-6.11.1/oslo_config/tests/test_validator.py --- old/oslo.config-6.8.1/oslo_config/tests/test_validator.py 1970-01-01 01:00:00.000000000 +0100 +++ new/oslo.config-6.11.1/oslo_config/tests/test_validator.py 2019-08-29 11:45:05.000000000 +0200 @@ -0,0 +1,114 @@ +# Copyright 2019 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import mock +from oslotest import base +import six + +from oslo_config import cfg +from oslo_config import fixture +from oslo_config import validator + + +OPT_DATA = {'options': {'foo': {'opts': [{'name': 'opt'}]}, + 'bar': {'opts': [{'name': 'opt'}]}, + }, + 'deprecated_options': {'bar': [{'name': 'opt'}]}} +VALID_CONF = """ +[foo] +opt = value +""" +DEPRECATED_CONF = """ +[bar] +opt = value +""" +INVALID_CONF = """ +[foo] +opts = value +""" +MISSING_GROUP_CONF = """ +[oo] +opt = value +""" + + +class TestValidator(base.BaseTestCase): + def setUp(self): + super(TestValidator, self).setUp() + self.conf = cfg.ConfigOpts() + self.conf_fixture = self.useFixture(fixture.Config(self.conf)) + validator._register_cli_opts(self.conf) + if six.PY2: + self.open_name = '__builtin__.open' + else: + self.open_name = 'builtins.open' + + @mock.patch('oslo_config.validator.load_opt_data') + def test_passing(self, mock_lod): + mock_lod.return_value = OPT_DATA + self.conf_fixture.config(opt_data='mocked.yaml', + input_file='mocked.conf') + m = mock.mock_open(read_data=VALID_CONF) + with mock.patch(self.open_name, m): + self.assertEqual(0, validator._validate(self.conf)) + + @mock.patch('oslo_config.validator.load_opt_data') + def test_deprecated(self, mock_lod): + mock_lod.return_value = OPT_DATA + self.conf_fixture.config(opt_data='mocked.yaml', + input_file='mocked.conf') + m = mock.mock_open(read_data=DEPRECATED_CONF) + with mock.patch(self.open_name, m): + self.assertEqual(0, validator._validate(self.conf)) + + @mock.patch('oslo_config.validator.load_opt_data') + def test_deprecated_fatal_warnings(self, mock_lod): + mock_lod.return_value = OPT_DATA + self.conf_fixture.config(opt_data='mocked.yaml', + input_file='mocked.conf', + fatal_warnings=True) + m = mock.mock_open(read_data=DEPRECATED_CONF) + with mock.patch(self.open_name, m): + self.assertEqual(1, validator._validate(self.conf)) + + @mock.patch('oslo_config.validator.load_opt_data') + def test_missing(self, mock_lod): + mock_lod.return_value = OPT_DATA + self.conf_fixture.config(opt_data='mocked.yaml', + input_file='mocked.conf') + m = mock.mock_open(read_data=INVALID_CONF) + with mock.patch(self.open_name, m): + self.assertEqual(1, validator._validate(self.conf)) + + @mock.patch('oslo_config.validator.load_opt_data') + def test_missing_group(self, mock_lod): + mock_lod.return_value = OPT_DATA + self.conf_fixture.config(opt_data='mocked.yaml', + input_file='mocked.conf') + m = mock.mock_open(read_data=MISSING_GROUP_CONF) + with mock.patch(self.open_name, m): + self.assertEqual(1, validator._validate(self.conf)) + + @mock.patch('oslo_config.validator.load_opt_data') + def test_exclude_groups(self, mock_lod): + mock_lod.return_value = OPT_DATA + self.conf_fixture.config(opt_data='mocked.yaml', + input_file='mocked.conf', + exclude_group=['oo']) + m = mock.mock_open(read_data=MISSING_GROUP_CONF) + with mock.patch(self.open_name, m): + self.assertEqual(0, validator._validate(self.conf)) + + def test_invalid_options(self): + self.assertRaises(RuntimeError, validator._validate, self.conf) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/oslo_config/types.py new/oslo.config-6.11.1/oslo_config/types.py --- old/oslo.config-6.8.1/oslo_config/types.py 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/oslo_config/types.py 2019-08-29 11:45:05.000000000 +0200 @@ -144,7 +144,7 @@ value = str(value) if self.quotes and value: if value[0] in "\"'": - if value[-1] != value[0]: + if len(value) == 1 or value[-1] != value[0]: raise ValueError('Non-closed quote: %s' % value) value = value[1:-1] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/oslo_config/validator.py new/oslo.config-6.11.1/oslo_config/validator.py --- old/oslo.config-6.8.1/oslo_config/validator.py 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/oslo_config/validator.py 2019-08-29 11:45:05.000000000 +0200 @@ -48,9 +48,18 @@ 'fatal-warnings', default=False, help='Report failure if any warnings are found.'), + cfg.MultiStrOpt( + 'exclude-group', + default=[], + help='Groups that should not be validated if they are present in the ' + 'specified input-file. This may be necessary for dynamically ' + 'named groups which do not appear in the sample config data.'), ] +KNOWN_BAD_GROUPS = ['keystone_authtoken'] + + def _register_cli_opts(conf): """Register the formatter's CLI options with a ConfigOpts instance. @@ -79,28 +88,41 @@ return option in name_data +def load_opt_data(conf): + with open(conf.opt_data) as f: + return yaml.safe_load(f) + + def _validate(conf): conf.register_opts(_validator_opts) if conf.namespace: groups = generator._get_groups(generator._list_opts(conf.namespace)) opt_data = generator._generate_machine_readable_data(groups, conf) elif conf.opt_data: - with open(conf.opt_data) as f: - opt_data = yaml.safe_load(f) + opt_data = load_opt_data(conf) else: # TODO(bnemec): Implement this logic with group? - raise RuntimeError('Neither namespace or opt-data provided.') + raise RuntimeError('Neither namespace nor opt-data provided.') sections = {} parser = cfg.ConfigParser(conf.input_file, sections) parser.parse() warnings = False errors = False for section, options in sections.items(): + if section in conf.exclude_group: + continue for option in options: if _validate_deprecated_opt(section, option, opt_data): logging.warn('Deprecated opt %s/%s found', section, option) warnings = True elif not _validate_opt(section, option, opt_data): + if section in KNOWN_BAD_GROUPS: + logging.info('Ignoring missing option "%s" from group ' + '"%s" because the group is known to have ' + 'incomplete sample config data and thus ' + 'cannot be validated properly.', + option, section) + continue logging.error('%s/%s not found', section, option) errors = True if errors or (warnings and conf.fatal_warnings): @@ -111,7 +133,7 @@ def main(): """The main function of oslo-config-validator.""" version = pkg_resources.get_distribution('oslo.config').version - logging.basicConfig(level=logging.WARN) + logging.basicConfig(level=logging.INFO) conf = cfg.ConfigOpts() _register_cli_opts(conf) try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/releasenotes/notes/validator-exclude-groups-ad2f046522a3407e.yaml new/oslo.config-6.11.1/releasenotes/notes/validator-exclude-groups-ad2f046522a3407e.yaml --- old/oslo.config-6.8.1/releasenotes/notes/validator-exclude-groups-ad2f046522a3407e.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/oslo.config-6.11.1/releasenotes/notes/validator-exclude-groups-ad2f046522a3407e.yaml 2019-08-29 11:45:05.000000000 +0200 @@ -0,0 +1,8 @@ +--- +features: + - | + The ``oslo-config-validator`` tool now has a new option, + ``--exclude-group``, that allows deployers to ignore certain groups that + might not appear in the sample config data, perhaps because the name of + the group depends on other configuration values. This way the validator + can still be used on the known groups. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/releasenotes/source/conf.py new/oslo.config-6.11.1/releasenotes/source/conf.py --- old/oslo.config-6.8.1/releasenotes/source/conf.py 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/releasenotes/source/conf.py 2019-08-29 11:45:05.000000000 +0200 @@ -46,7 +46,6 @@ repository_name = 'openstack/oslo.config' bug_project = 'oslo.config' bug_tag = '' -html_last_updated_fmt = '%Y-%m-%d %H:%M' # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -61,7 +60,6 @@ master_doc = 'index' # General information about the project. -project = u'oslo.config Release Notes' copyright = u'2016, oslo.config Developers' # Release notes do not need a version in the title, they span @@ -191,52 +189,6 @@ # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None -# Output file base name for HTML help builder. -htmlhelp_basename = 'oslo.configReleaseNotesdoc' - - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # 'preamble': '', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ('index', 'oslo.configReleaseNotes.tex', - u'oslo.config Release Notes Documentation', - u'oslo.config Developers', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# latex_use_parts = False - -# If true, show page references after internal links. -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# latex_appendices = [] - -# If false, no module index is generated. -# latex_domain_indices = True - # -- Options for manual page output --------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/releasenotes/source/index.rst new/oslo.config-6.11.1/releasenotes/source/index.rst --- old/oslo.config-6.8.1/releasenotes/source/index.rst 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/releasenotes/source/index.rst 2019-08-29 11:45:05.000000000 +0200 @@ -6,6 +6,7 @@ :maxdepth: 1 unreleased + stein rocky queens pike diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/releasenotes/source/stein.rst new/oslo.config-6.11.1/releasenotes/source/stein.rst --- old/oslo.config-6.8.1/releasenotes/source/stein.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/oslo.config-6.11.1/releasenotes/source/stein.rst 2019-08-29 11:45:05.000000000 +0200 @@ -0,0 +1,6 @@ +=================================== + Stein Series Release Notes +=================================== + +.. release-notes:: + :branch: stable/stein diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/setup.cfg new/oslo.config-6.11.1/setup.cfg --- old/oslo.config-6.8.1/setup.cfg 2019-02-28 19:03:10.000000000 +0100 +++ new/oslo.config-6.11.1/setup.cfg 2019-08-29 11:45:52.000000000 +0200 @@ -17,7 +17,8 @@ Programming Language :: Python :: 2 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 - Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 [files] packages = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/test-requirements.txt new/oslo.config-6.11.1/test-requirements.txt --- old/oslo.config-6.8.1/test-requirements.txt 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/test-requirements.txt 2019-08-29 11:45:05.000000000 +0200 @@ -1,11 +1,12 @@ # The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. + hacking>=1.1.0,<1.2.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD -stestr>=2.0.0 # Apache-2.0 +stestr>=2.1.0 # Apache-2.0 testtools>=2.2.0 # MIT oslotest>=3.2.0 # Apache-2.0 @@ -19,14 +20,9 @@ # deps = {[testenv]deps} coverage coverage!=4.4,>=4.0 # Apache-2.0 -# this is required for the sphinx extension -sphinx!=1.6.6,!=1.6.7,>=1.6.2 # BSD - # mocking framework -mock>=2.0.0 # BSD +mock>=3.0.0 # BSD requests_mock>=1.5.0 # Apache-2.0 # Bandit security code scanner -bandit>=1.1.0 # Apache-2.0 - -reno>=2.5.0 # Apache-2.0 +bandit>=1.1.0,<1.6.0 # Apache-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/oslo.config-6.8.1/tox.ini new/oslo.config-6.11.1/tox.ini --- old/oslo.config-6.8.1/tox.ini 2019-02-28 19:02:06.000000000 +0100 +++ new/oslo.config-6.11.1/tox.ini 2019-08-29 11:45:05.000000000 +0200 @@ -1,20 +1,24 @@ [tox] minversion = 2.0 distribute = False -envlist = py35,py27,pep8 +envlist = py27,py37,pep8 [testenv] install_command = pip install {opts} {packages} -setenv = OS_STDOUT_CAPTURE=1 - OS_STDERR_CAPTURE=1 - OS_TEST_TIMEOUT=60 +whitelist_externals = + find +setenv = + OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:1} + OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:1} + OS_TEST_TIMEOUT={env:OS_TEST_TIMEOUT:60} deps = -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt + -r{toxinidir}/doc/requirements.txt commands = find . -type f -name "*.pyc" -delete - stestr run {posargs} + stestr run --suppress-attachments {posargs} stestr slowest [testenv:lower-constraints] @@ -23,6 +27,7 @@ -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt + -r{toxinidir}/doc/requirements.txt [testenv:py27] basepython = python2.7 @@ -36,6 +41,8 @@ [testenv:cover] basepython = python3 +setenv = + PYTHON=coverage run --source oslo_config --parallel-mode commands = coverage erase {[testenv]commands} @@ -53,8 +60,8 @@ whitelist_externals = rm deps = -r{toxinidir}/doc/requirements.txt commands = - rm -fr doc/build - sphinx-build -W -b html doc/source doc/build/html {posargs} + rm -fr doc/build + sphinx-build -W -b html doc/source doc/build/html {posargs} [testenv:bandit] basepython = python3
