Fix exception when api_extensions is set to empty

test.is_extension_enabled() is not checking if
config_dict[service] list is empty

Added a check if config_dict[service] is empty the
function will return False which means no extensions
are enabled

Change-Id: I2ee64f205c393637b5fc65897f1489292781c0be
Closes-Bug: 1342516
This commit is contained in:
Simeon Monov 2014-07-16 07:32:38 +03:00
parent 147cc20f8c
commit 5d7effe9e4
3 changed files with 18 additions and 8 deletions

View File

@ -391,12 +391,14 @@
# A list of enabled compute extensions with a special entry
# all which indicates every extension is enabled. Each
# extension should be specified with alias name (list value)
# extension should be specified with alias name. Empty list
# indicates all extensions are disabled (list value)
#api_extensions=all
# A list of enabled v3 extensions with a special entry all
# which indicates every extension is enabled. Each extension
# should be specified with alias name (list value)
# should be specified with alias name. Empty list indicates
# all extensions are disabled (list value)
#api_v3_extensions=all
# Does the test environment support changing the admin
@ -750,7 +752,8 @@
#ipv6=true
# A list of enabled network extensions with a special entry
# all which indicates every extension is enabled (list value)
# all which indicates every extension is enabled. Empty list
# indicates all extensions are disabled (list value)
#api_extensions=all
# Allow the execution of IPv6 subnet tests that use the
@ -1105,7 +1108,8 @@
#snapshot=true
# A list of enabled volume extensions with a special entry all
# which indicates every extension is enabled (list value)
# which indicates every extension is enabled. Empty list
# indicates all extensions are disabled (list value)
#api_extensions=all
# Is the v1 volume API enabled (boolean value)

View File

@ -268,12 +268,14 @@ ComputeFeaturesGroup = [
default=['all'],
help='A list of enabled compute extensions with a special '
'entry all which indicates every extension is enabled. '
'Each extension should be specified with alias name'),
'Each extension should be specified with alias name. '
'Empty list indicates all extensions are disabled'),
cfg.ListOpt('api_v3_extensions',
default=['all'],
help='A list of enabled v3 extensions with a special entry all'
' which indicates every extension is enabled. '
'Each extension should be specified with alias name'),
'Each extension should be specified with alias name. '
'Empty list indicates all extensions are disabled'),
cfg.BoolOpt('change_password',
default=False,
help="Does the test environment support changing the admin "
@ -441,7 +443,8 @@ NetworkFeaturesGroup = [
cfg.ListOpt('api_extensions',
default=['all'],
help='A list of enabled network extensions with a special '
'entry all which indicates every extension is enabled'),
'entry all which indicates every extension is enabled. '
'Empty list indicates all extensions are disabled'),
cfg.BoolOpt('ipv6_subnet_attributes',
default=False,
help="Allow the execution of IPv6 subnet tests that use "
@ -546,7 +549,8 @@ VolumeFeaturesGroup = [
cfg.ListOpt('api_extensions',
default=['all'],
help='A list of enabled volume extensions with a special '
'entry all which indicates every extension is enabled'),
'entry all which indicates every extension is enabled. '
'Empty list indicates all extensions are disabled'),
cfg.BoolOpt('api_v1',
default=True,
help="Is the v1 volume API enabled"),

View File

@ -215,6 +215,8 @@ def is_extension_enabled(extension_name, service):
'network': CONF.network_feature_enabled.api_extensions,
'object': CONF.object_storage_feature_enabled.discoverable_apis,
}
if len(config_dict[service]) == 0:
return False
if config_dict[service][0] == 'all':
return True
if extension_name in config_dict[service]: