fix cfgvalidator_driver error missing id_ attrib

oslo.config 4.4.0 adds some default options to each config object.
These default options caused errors because they are not expected
by the code in cfgvalidator_driver.
This patch fixes the error by having cfgvalidator_driver code
filter out unexpected options based on required attributes.

Change-Id: I6b8839dcb0e53839206ec2bb42c8945dc867249a
Release-team: bugfix
This commit is contained in:
Eric K 2018-08-05 22:17:52 -07:00 committed by Eric Kao
parent 672ca87558
commit 502f40a7d2
1 changed files with 7 additions and 0 deletions

View File

@ -478,6 +478,13 @@ class ValidatorDriver(datasource_driver.PollingDataSourceDriver):
def _do_translation(option, group_name='DEFAULT'):
option = option['opt']
# skip options that do not have the required attributes
# avoids processing built-in options included by oslo.config, which
# don't have all the needed IdentifiedOpt attributes.
# see: https://github.com/openstack/oslo.config/commit/5ad89d40210bf5922de62e30b096634cac36da6c#diff-768b817a50237989cacd1a8064b4a8af # noqa
for attribute in ['id_', 'name', 'type', 'ns_id']:
if not hasattr(option, attribute):
return
self.translate_option(option, group_name)