Adding oslo.config entry points for yaql and cache opts

To assist with automated configuration validation, we need entry points
for oslo.config.opts for yaql and cache options.

Change-Id: I228282d2c05f6583fe972470b326e7182f635b39
This commit is contained in:
David Vallee Delisle 2021-05-04 21:50:35 -04:00 committed by Takashi Kajinami
parent a9ccce8b0c
commit 0f7ce2cfa6
4 changed files with 68 additions and 49 deletions

View File

@ -1,16 +1,19 @@
[DEFAULT]
output_file = etc/heat/heat.conf.sample
wrap_width = 79
namespace = heat.common.cache
namespace = heat.common.config
namespace = heat.common.context
namespace = heat.common.crypt
namespace = heat.engine.clients.os.keystone.heat_keystoneclient
namespace = heat.engine.hot.functions
namespace = heat.common.wsgi
namespace = heat.engine.clients
namespace = heat.engine.notification
namespace = heat.engine.resources
namespace = heat.api.aws.ec2token
namespace = keystonemiddleware.auth_token
namespace = oslo.cache
namespace = oslo.messaging
namespace = oslo.middleware
namespace = oslo.cache

View File

@ -21,20 +21,6 @@ from oslo_config import cfg
from heat.common.i18n import _
def register_cache_configurations(conf):
"""Register all configurations required for oslo.cache.
The procedure registers all configurations required for oslo.cache.
It should be called before configuring of cache region
:param conf: instance of heat configuration
:returns: updated heat configuration
"""
# register global configurations for caching in heat
core.configure(conf)
# register heat specific configurations
constraint_cache_group = cfg.OptGroup('constraint_validation_cache')
constraint_cache_opts = [
cfg.IntOpt('expiration_time', default=60,
@ -52,8 +38,6 @@ def register_cache_configurations(conf):
'toggle for oslo.cache(enabled=True in [cache] group) '
'must be enabled to use this feature.'))
]
conf.register_group(constraint_cache_group)
conf.register_opts(constraint_cache_opts, group=constraint_cache_group)
extension_cache_group = cfg.OptGroup('service_extension_cache')
extension_cache_opts = [
@ -70,8 +54,6 @@ def register_cache_configurations(conf):
'oslo.cache(enabled=True in [cache] group) must be '
'enabled to use this feature.'))
]
conf.register_group(extension_cache_group)
conf.register_opts(extension_cache_opts, group=extension_cache_group)
find_cache_group = cfg.OptGroup('resource_finder_cache')
find_cache_opts = [
@ -88,12 +70,39 @@ def register_cache_configurations(conf):
'toggle for oslo.cache(enabled=True in [cache] group) '
'must be enabled to use this feature.'))
]
def register_cache_configurations(conf):
"""Register all configurations required for oslo.cache.
The procedure registers all configurations required for oslo.cache.
It should be called before configuring of cache region
:param conf: instance of heat configuration
:returns: updated heat configuration
"""
# register global configurations for caching in heat
core.configure(conf)
# register heat specific configurations
conf.register_group(constraint_cache_group)
conf.register_opts(constraint_cache_opts, group=constraint_cache_group)
conf.register_group(extension_cache_group)
conf.register_opts(extension_cache_opts, group=extension_cache_group)
conf.register_group(find_cache_group)
conf.register_opts(find_cache_opts, group=find_cache_group)
return conf
def list_opts():
yield constraint_cache_group.name, constraint_cache_opts
yield extension_cache_group.name, extension_cache_opts
yield find_cache_group.name, find_cache_opts
# variable that stores an initialized cache region for heat
_REGION = None

View File

@ -31,7 +31,8 @@ from heat.engine import function
LOG = logging.getLogger(__name__)
opts = [
yaql_group = cfg.OptGroup('yaql')
yaql_opts = [
cfg.IntOpt('limit_iterators',
default=200,
help=_('The maximum number of elements in collection '
@ -41,7 +42,11 @@ opts = [
help=_('The maximum size of memory in bytes that '
'expression can take for its evaluation.'))
]
cfg.CONF.register_opts(opts, group='yaql')
cfg.CONF.register_opts(yaql_opts, group=yaql_group)
def list_opts():
yield yaql_group.name, yaql_opts
class GetParam(function.Function):

View File

@ -49,10 +49,12 @@ wsgi_scripts =
heat-wsgi-api-cfn = heat.httpd.heat_api_cfn:init_application
oslo.config.opts =
heat.common.cache = heat.common.cache:list_opts
heat.common.config = heat.common.config:list_opts
heat.common.context = heat.common.context:list_opts
heat.common.crypt = heat.common.crypt:list_opts
heat.engine.clients.os.keystone.heat_keystoneclient = heat.engine.clients.os.keystone.heat_keystoneclient:list_opts
heat.engine.hot.functions = heat.engine.hot.functions:list_opts
heat.common.wsgi = heat.common.wsgi:list_opts
heat.engine.clients = heat.engine.clients:list_opts
heat.engine.notification = heat.engine.notification:list_opts