Reference DEFAULT_SERVICETYPE OptGoup names in lowercase

To have consistent option group name format across projects,
oslo.config now normalizes all non lowercase group names to lowercase
when loading conf files.
Thus conf files are backwards compatible but option group references
in the code must now use lowercase before we update oslo.config.

This patch replaces all 'DEFAULT_SERVICETYPE' references to
'default_servicetype'

Change-Id: Iccab055c4664e11c9618706e594416194065048b
This commit is contained in:
Zhongyue Luo 2013-05-18 21:52:15 +08:00
parent 59d6ad2035
commit 2f13345b86
4 changed files with 8 additions and 8 deletions

View File

@ -283,7 +283,7 @@ notification_topics = notifications
# default driver to use for quota checks
# quota_driver = quantum.quota.ConfDriver
[DEFAULT_SERVICETYPE]
[default_servicetype]
# Description of the default service type (optional)
# description = "default service type"
# Enter a service definition line for each advanced service provided

View File

@ -43,13 +43,13 @@ default_servicetype_opts = [
'using the format: <service>:<plugin>[:<driver>]'))
]
cfg.CONF.register_opts(default_servicetype_opts, 'DEFAULT_SERVICETYPE')
cfg.CONF.register_opts(default_servicetype_opts, 'default_servicetype')
def parse_service_definition_opt():
"""Parse service definition opts and returns result."""
results = []
svc_def_opt = cfg.CONF.DEFAULT_SERVICETYPE.service_definition
svc_def_opt = cfg.CONF.default_servicetype.service_definition
try:
for svc_def_str in svc_def_opt:
split = svc_def_str.split(':')
@ -72,7 +72,7 @@ def parse_service_definition_opt():
class NoDefaultServiceDefinition(q_exc.QuantumException):
message = _("No default service definition in configuration file. "
"Please add service definitions using the service_definition "
"variable in the [DEFAULT_SERVICETYPE] section")
"variable in the [default_servicetype] section")
class ServiceTypeNotFound(q_exc.NotFound):
@ -129,12 +129,12 @@ class ServiceTypeManager(object):
self._initialize_db()
ctx = context.get_admin_context()
# Init default service type from configuration file
svc_defs = cfg.CONF.DEFAULT_SERVICETYPE.service_definition
svc_defs = cfg.CONF.default_servicetype.service_definition
if not svc_defs:
raise NoDefaultServiceDefinition()
def_service_type = {'name': DEFAULT_SVCTYPE_NAME,
'description':
cfg.CONF.DEFAULT_SERVICETYPE.description,
cfg.CONF.default_servicetype.description,
'service_definitions':
parse_service_definition_opt(),
'default': True}

View File

@ -25,7 +25,7 @@ lock_path = $state_path/lock
[DATABASE]
sql_connection = 'sqlite:///:memory:'
[DEFAULT_SERVICETYPE]
[default_servicetype]
description = "default service type"
service_definition=dummy:quantum.tests.unit.dummy_plugin.QuantumDummyPlugin

View File

@ -252,7 +252,7 @@ class ServiceTypeManagerTestCase(ServiceTypeTestCaseBase):
servicetype_db.ServiceTypeManager._instance = None
plugin_name = "%s.%s" % (dp.__name__, dp.DummyServicePlugin.__name__)
cfg.CONF.set_override('service_definition', ['dummy:%s' % plugin_name],
group='DEFAULT_SERVICETYPE')
group='default_servicetype')
self.addCleanup(db_api.clear_db)
super(ServiceTypeManagerTestCase, self).setUp()