diff options
author | Zuul <zuul@review.opendev.org> | 2019-06-03 17:27:44 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-06-03 17:27:44 +0000 |
commit | 9b454d728904fdeac334c94d1c33ef37188f1244 (patch) | |
tree | a6e0a939cd53b168fd30498322a0d7cdfe1a9efd | |
parent | a6313baf656cc7dc96783489613027c9f6c1958a (diff) | |
parent | c30d9c0a08f064b36a6ebb5fba1f2d6d2d9aa8fb (diff) | |
download | oslo-config-9b454d728904fdeac334c94d1c33ef37188f1244.tar.gz |
Merge "Add exclude-groups option to config validator"
-rw-r--r-- | doc/source/cli/validator.rst | 9 | ||||
-rw-r--r-- | oslo_config/validator.py | 8 | ||||
-rw-r--r-- | releasenotes/notes/validator-exclude-groups-ad2f046522a3407e.yaml | 8 |
3 files changed, 25 insertions, 0 deletions
diff --git a/doc/source/cli/validator.rst b/doc/source/cli/validator.rst index 637aeeb..b508b71 100644 --- a/doc/source/cli/validator.rst +++ b/doc/source/cli/validator.rst @@ -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. diff --git a/oslo_config/validator.py b/oslo_config/validator.py index b296d92..6f8771e 100644 --- a/oslo_config/validator.py +++ b/oslo_config/validator.py @@ -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) diff --git a/releasenotes/notes/validator-exclude-groups-ad2f046522a3407e.yaml b/releasenotes/notes/validator-exclude-groups-ad2f046522a3407e.yaml new file mode 100644 index 0000000..64973e2 --- /dev/null +++ b/releasenotes/notes/validator-exclude-groups-ad2f046522a3407e.yaml @@ -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. |