Fix verify-config KeyError

When a user runs verify-config while custom, third
party plugins are available in the system, it fails
with KeyError.
The patch fixes that by informing a user about the
plugins and suggesting their setup.

Related-Bug: #1812385
Change-Id: I8019a82717d9463bdc1a6e5025758e1f917358bb
This commit is contained in:
Martin Kopec 2019-01-18 14:23:06 +00:00
parent 98c0aca141
commit 07a572ca17
1 changed files with 17 additions and 6 deletions

View File

@ -365,11 +365,11 @@ def check_service_availability(os, update):
catalog_type = getattr(cfg, 'catalog_type', None)
if not catalog_type:
continue
else:
if cfgname == 'identity':
# Keystone is a required service for tempest
continue
if catalog_type not in services:
try:
if getattr(CONF.service_available, codename_match[cfgname]):
print('Endpoint type %s not found either disable service '
'%s or fix the catalog_type in the config file' % (
@ -377,7 +377,13 @@ def check_service_availability(os, update):
if update:
change_option(codename_match[cfgname],
'service_available', False)
except KeyError:
print('%s is a third party plugin, cannot be verified '
'automatically, but it is suggested that it is set to '
'False because %s service is not available ' % (
cfgname, catalog_type))
else:
try:
if not getattr(CONF.service_available,
codename_match[cfgname]):
print('Endpoint type %s is available, service %s should be'
@ -391,6 +397,11 @@ def check_service_availability(os, update):
avail_services.append(codename_match[cfgname])
else:
avail_services.append(codename_match[cfgname])
except KeyError:
print('%s is a third party plugin, cannot be verified '
'automatically, but it is suggested that it is set to '
'True because %s service is available ' % (
cfgname, catalog_type))
return avail_services