Automatically register engine options

Register the engine options as soon as we import something from the engine
package. This means we do not need to explicitly do it in all of the unit
tests.

Change-Id: I8fb0c8665d0e0255521e21a6aac223ad1e3b1b25
Signed-off-by: Zane Bitter <zbitter@redhat.com>
This commit is contained in:
Zane Bitter 2012-11-30 10:44:46 +01:00
parent 6f31e49f69
commit 180df199fe
10 changed files with 17 additions and 19 deletions

View File

@ -53,11 +53,10 @@ if __name__ == '__main__':
cfg.CONF(project='heat', prog='heat-engine')
config.setup_logging()
config.register_engine_opts()
db_api.configure()
from heat.engine import service as engine
db_api.configure()
srv = engine.EngineService(cfg.CONF.host,
'engine')
launcher = service.launch(srv)

View File

@ -1 +1,17 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from heat.common import config
config.register_engine_opts()

View File

@ -25,7 +25,6 @@ import httplib
import json
import urlparse
from heat.common import config
from heat.common import context
from heat.common import identifier
from heat.openstack.common import cfg
@ -1104,7 +1103,6 @@ class StackControllerTest(unittest.TestCase):
self.maxDiff = None
self.m = mox.Mox()
config.register_engine_opts()
cfg.CONF.set_default('engine_topic', 'engine')
cfg.CONF.set_default('host', 'host')
self.topic = '%s.%s' % (cfg.CONF.engine_topic, cfg.CONF.host)

View File

@ -25,7 +25,6 @@ import httplib
import json
import urlparse
from heat.common import config
from heat.common import context
from heat.openstack.common import cfg
from heat.openstack.common import rpc
@ -463,7 +462,6 @@ class WatchControllerTest(unittest.TestCase):
self.maxDiff = None
self.m = mox.Mox()
config.register_engine_opts()
cfg.CONF.set_default('engine_topic', 'engine')
cfg.CONF.set_default('host', 'host')
self.topic = '%s.%s' % (cfg.CONF.engine_topic, cfg.CONF.host)

View File

@ -26,7 +26,6 @@ import httplib
import urlparse
import webob.exc
from heat.common import config
from heat.common import context
from heat.common import identifier
from heat.openstack.common import cfg
@ -164,7 +163,6 @@ class ControllerTest(object):
self.maxDiff = None
self.m = mox.Mox()
config.register_engine_opts()
cfg.CONF.set_default('engine_topic', 'engine')
cfg.CONF.set_default('host', 'host')
self.topic = '%s.%s' % (cfg.CONF.engine_topic, cfg.CONF.host)

View File

@ -22,7 +22,6 @@ import mox
import json
from nose.plugins.attrib import attr
from heat.common import config
from heat.common import context
from heat.tests.v1_1 import fakes
import heat.engine.api as engine_api
@ -100,7 +99,6 @@ class DummyThreadGroup(object):
class stackCreateTest(unittest.TestCase):
def setUp(self):
self.m = mox.Mox()
config.register_engine_opts()
def tearDown(self):
self.m.UnsetStubs()

View File

@ -26,7 +26,6 @@ from nose.plugins.attrib import attr
from heat.common import exception
from heat.common import context
from heat.common import config
from heat.common import template_format
from heat.engine import parser
from heat.engine.resources import instance
@ -56,7 +55,6 @@ class LoadBalancerTest(unittest.TestCase):
self.m.StubOutWithMock(instance.Instance, 'nova')
self.m.StubOutWithMock(self.fc.servers, 'create')
self.m.StubOutWithMock(Metadata, '__set__')
config.register_engine_opts()
def tearDown(self):
self.m.UnsetStubs()

View File

@ -23,7 +23,6 @@ import stubout
from nose.plugins.attrib import attr
import unittest
from heat.common import config
from heat.common import context
from heat.rpc import client as rpc_client
from heat.openstack.common import cfg
@ -35,7 +34,6 @@ class EngineRpcAPITestCase(unittest.TestCase):
def setUp(self):
self.context = context.get_admin_context()
config.register_engine_opts()
cfg.CONF.set_default('rpc_backend',
'heat.openstack.common.rpc.impl_fake')
cfg.CONF.set_default('verbose', True)

View File

@ -26,7 +26,6 @@ from nose.plugins.attrib import attr
from heat.common import context
from heat.common import exception
from heat.common import config
from heat.common import template_format
from heat.engine import parser
from heat.engine.resources import user
@ -40,7 +39,6 @@ class UserTest(unittest.TestCase):
def setUp(self):
self.m = mox.Mox()
self.fc = fakes.FakeKeystoneClient(username='test_stack.CfnUser')
config.register_engine_opts()
cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role')
def tearDown(self):

View File

@ -31,7 +31,6 @@ from heat.common import template_format
from heat.engine import parser
from heat.engine.resources import wait_condition as wc
from heat.common import context
from heat.common import config
from heat.openstack.common import cfg
logger = logging.getLogger('test_waitcondition')
@ -68,7 +67,6 @@ class WaitConditionTest(unittest.TestCase):
'_create_timeout')
self.m.StubOutWithMock(eventlet, 'sleep')
config.register_engine_opts()
cfg.CONF.set_default('heat_waitcondition_server_url',
'http://127.0.0.1:8000/v1/waitcondition')
@ -156,7 +154,6 @@ class WaitConditionTest(unittest.TestCase):
class WaitConditionHandleTest(unittest.TestCase):
def setUp(self):
self.m = mox.Mox()
config.register_engine_opts()
cfg.CONF.set_default('heat_waitcondition_server_url',
'http://127.0.0.1:8000/v1/waitcondition')