From 2f13345b861e2873abbbeaa69b9620ce431a3baf Mon Sep 17 00:00:00 2001 From: Zhongyue Luo Date: Sat, 18 May 2013 21:52:15 +0800 Subject: [PATCH] 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 --- etc/quantum.conf | 2 +- quantum/db/servicetype_db.py | 10 +++++----- quantum/tests/etc/quantum.conf.test | 2 +- quantum/tests/unit/test_servicetype.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/quantum.conf b/etc/quantum.conf index 095d1e9d4a2..93291e6bdcf 100644 --- a/etc/quantum.conf +++ b/etc/quantum.conf @@ -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 diff --git a/quantum/db/servicetype_db.py b/quantum/db/servicetype_db.py index 1fa1e5cb0df..db9417eb8ab 100644 --- a/quantum/db/servicetype_db.py +++ b/quantum/db/servicetype_db.py @@ -43,13 +43,13 @@ default_servicetype_opts = [ 'using the format: :[:]')) ] -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} diff --git a/quantum/tests/etc/quantum.conf.test b/quantum/tests/etc/quantum.conf.test index cedeb3c2788..c6c0eb79dfa 100644 --- a/quantum/tests/etc/quantum.conf.test +++ b/quantum/tests/etc/quantum.conf.test @@ -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 diff --git a/quantum/tests/unit/test_servicetype.py b/quantum/tests/unit/test_servicetype.py index 670a544755a..2b6fd3a81b5 100644 --- a/quantum/tests/unit/test_servicetype.py +++ b/quantum/tests/unit/test_servicetype.py @@ -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()