diff options
author | Zuul <zuul@review.opendev.org> | 2019-07-01 17:04:13 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-07-01 17:04:13 +0000 |
commit | dea9af2fe91e3abe6ca88ea8739cff023191abb9 (patch) | |
tree | d80f0ec3eaee6b4aaff2c7cec918f3587b43890e | |
parent | 2a4f075391853dab337abce2607e1d2662c0d803 (diff) | |
parent | 0c734acf17c8382f0c0c360aa318f25f0d8c75f4 (diff) | |
download | oslo-config-dea9af2fe91e3abe6ca88ea8739cff023191abb9.tar.gz |
Merge "Add special handling for keystone_authtoken group"6.11.0
-rw-r--r-- | doc/source/cli/validator.rst | 36 | ||||
-rw-r--r-- | oslo_config/validator.py | 12 |
2 files changed, 33 insertions, 15 deletions
diff --git a/doc/source/cli/validator.rst b/doc/source/cli/validator.rst index b508b71..d829b8d 100644 --- a/doc/source/cli/validator.rst +++ b/doc/source/cli/validator.rst @@ -28,15 +28,17 @@ 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:: +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,15 +54,17 @@ 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:: +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 ----------------------- @@ -70,3 +74,7 @@ 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 --git a/oslo_config/validator.py b/oslo_config/validator.py index 268c672..e200b19 100644 --- a/oslo_config/validator.py +++ b/oslo_config/validator.py @@ -57,6 +57,9 @@ _validator_opts = [ ] +KNOWN_BAD_GROUPS = ['keystone_authtoken'] + + def _register_cli_opts(conf): """Register the formatter's CLI options with a ConfigOpts instance. @@ -113,6 +116,13 @@ def _validate(conf): 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): @@ -123,7 +133,7 @@ def _validate(conf): 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: |