
When dynamic groups are used, the sample config data may not know about those group names. As a result, validation of such files will always fail. This makes it hard to automate config checks since the output would need to be inspected manually to verify that the missing options are all from the dynamic group. Ideally, we would provide some way to map sample config groups to the dynamic group name used in the actual config, but that would be more complicated and still might not work in every case if a project doesn't include sample sections for a dynamic group (although they _should_ be doing so). Allowing certain group names to be excluded from validation lets us to solve this problem in a simple way and maintain validation of 99%[0] of the config options and enables the validation to be scripted since it won't need manual verification of the error output. Change-Id: I352fd48f86ecb876fe26a5e50e9a2633af1fff3d 0: citation needed ;-)
3.1 KiB
oslo-config-validator
oslo-config-validator is a utility for verifying that the entries in a config file are correct. It will report an error for any options found that are not defined by the service, and a warning for any deprecated options found.
6.5.0
Usage
There are two primary ways to use the config validator. It can use the sample config generator configuration file found in each service to determine the list of available options, or it can consume a machine-readable sample config that provides the same information.
Sample Config Generator Configuration
Note
When using this method, all dependencies of the service must be installed in the environment where the validator is run.
There are two parameters that must be passed to the validator in this
case: --config-file
and --input-file
.
--config-file
should point at the location of the sample
config generator configuration file, while --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:
$ 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
Machine-Readable Sample Config
Note
For most accurate results, the machine-readable sample config should be generated from the same version of the code as is running on the system whose config file is being validated.
In this case, a machine-readable sample config must first be
generated, as described in generator
.
This file is then passed to the validator with
--opt-data
, along with the 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:
$ 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
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.