Remove config opts for extension black/white list

The config opts of extension black/white list 'extensions_blacklist'
and 'extensions_whitelist' are deprecated for a long time. It's time
to remove it.

Partial-implement-blueprint api-no-more-extensions-pike

Change-Id: Ide8c302619825c7b41ee52baa7128c5bb2341aa4
This commit is contained in:
He Jie Xu 2017-03-28 19:54:44 +08:00 committed by John Garbutt
parent a2d1207032
commit de0a8440c8
3 changed files with 8 additions and 69 deletions

View File

@ -95,31 +95,6 @@ class ServersController(wsgi.Controller):
def __init__(self, **kwargs):
def _check_load_extension(required_function):
def should_load_extension(ext):
# Check whitelist is either empty or if not then the extension
# is in the whitelist
whitelist = CONF.osapi_v21.extensions_whitelist
blacklist = CONF.osapi_v21.extensions_blacklist
if not whitelist:
# if there is no whitelist, we accept everything,
# so we only care about the blacklist.
if ext.obj.alias in blacklist:
return False
else:
return True
else:
if ext.obj.alias in whitelist:
if ext.obj.alias in blacklist:
LOG.warning(
"Extension %s is both in whitelist and "
"blacklist, blacklisting takes precedence",
ext.obj.alias)
return False
else:
return True
else:
return False
def check_load_extension(ext):
if isinstance(ext.obj, extensions.V21APIExtensionBase):
# Filter out for the existence of the required
@ -133,7 +108,7 @@ class ServersController(wsgi.Controller):
'servers extension for function %(func)s',
{'ext_alias': ext.obj.alias,
'func': required_function})
return should_load_extension(ext)
return True
else:
LOG.debug(
'extension %(ext_alias)s is missing %(func)s',

View File

@ -18,49 +18,6 @@ from oslo_config import cfg
api_opts_group = cfg.OptGroup(name="osapi_v21", title="API v2.1 Options")
api_opts = [
cfg.ListOpt("extensions_blacklist",
default=[],
deprecated_for_removal=True,
deprecated_since="12.0.0",
deprecated_reason="""
API extensions are now part of the standard API. API extensions should be
disabled using policy, rather than via these configuration options.""",
help="""
This option is a list of all of the v2.1 API extensions to never load.
Possible values:
* A list of strings, each being the alias of an extension that you do not
wish to load.
Related options:
* enabled
* extensions_whitelist
"""),
cfg.ListOpt("extensions_whitelist",
default=[],
deprecated_for_removal=True,
deprecated_since="12.0.0",
deprecated_reason="""
API extensions are now part of the standard API. API extensions should be
disabled using policy, rather than via these configuration options.""",
help="""
This is a list of extensions. If it is empty, then *all* extensions except
those specified in the extensions_blacklist option will be loaded. If it is not
empty, then only those extensions in this list will be loaded, provided that
they are also not in the extensions_blacklist option.
Possible values:
* A list of strings, each being the alias of an extension that you wish to
load, or an empty list, which indicates that all extensions are to be run.
Related options:
* enabled
* extensions_blacklist
"""),
cfg.StrOpt("project_id_regex",
deprecated_for_removal=True,
deprecated_since="13.0.0",

View File

@ -0,0 +1,7 @@
---
upgrade:
- |
Deprecated config options to enable/disable extensions
``extensions_blacklist`` and ``extensions_whitelist`` have been removed.
This means all API extensions are always enabled. If you modifed policy,
please double check you have the correct policy settings for all APIs.