Merge "Add exclude-groups option to config validator"

This commit is contained in:
Zuul 2019-06-03 17:27:44 +00:00 committed by Gerrit Code Review
commit 9b454d7289
3 changed files with 25 additions and 0 deletions

View File

@ -61,3 +61,12 @@ a sample config file ``config-data.yaml`` created by the config generator::
ERROR:root:keystone_authtoken/project_name not found
ERROR:root:keystone_authtoken/password not found
ERROR:root:keystone_authtoken/auth_url not found
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.

View File

@ -48,6 +48,12 @@ _validator_opts = [
'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.'),
]
@ -96,6 +102,8 @@ def _validate(conf):
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)

View File

@ -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.