From 117e73ba572ea421deabb7bd05318388439e2056 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Sat, 27 Apr 2013 13:20:04 +0100 Subject: [PATCH] Remove engine_topic configuration option Fixes bug #1173575 This is currently broken since heat-engine always listens to the 'engine' topic and there isn't actually a good use case for this to be configurable, so let's kill it. Change-Id: I35c0292c921f81857f80a7f111df5ac330d54ecf --- bin/heat-engine | 3 ++- heat/common/config.py | 5 +---- heat/rpc/api.py | 2 ++ heat/rpc/client.py | 7 ++----- heat/tests/test_api_cfn_v1.py | 4 ++-- heat/tests/test_api_cloudwatch.py | 6 +++--- heat/tests/test_api_openstack_v1.py | 4 ++-- heat/tests/test_rpc_client.py | 4 ++-- 8 files changed, 16 insertions(+), 19 deletions(-) diff --git a/bin/heat-engine b/bin/heat-engine index 2eefea1d7c..084938805f 100755 --- a/bin/heat-engine +++ b/bin/heat-engine @@ -44,6 +44,7 @@ from heat.openstack.common import service from heat.common import config from heat.db import api as db_api +from heat.rpc import api as rpc_api LOG = logging.getLogger('heat.engine') @@ -62,6 +63,6 @@ if __name__ == '__main__': from heat.engine import service as engine db_api.configure() - srv = engine.EngineService(cfg.CONF.host, 'engine') + srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC) launcher = service.launch(srv) launcher.wait() diff --git a/heat/common/config.py b/heat/common/config.py index 02df22cf10..628157dd19 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -111,10 +111,7 @@ rpc_opts = [ default=socket.gethostname(), help='Name of the engine node. ' 'This can be an opaque identifier.' - 'It is not necessarily a hostname, FQDN, or IP address.'), - cfg.StrOpt('engine_topic', - default='engine', - help='the topic engine nodes listen on')] + 'It is not necessarily a hostname, FQDN, or IP address.')] def register_api_opts(): diff --git a/heat/rpc/api.py b/heat/rpc/api.py index b7c9d5e0b5..d8192328ca 100644 --- a/heat/rpc/api.py +++ b/heat/rpc/api.py @@ -12,6 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +ENGINE_TOPIC = 'engine' + PARAM_KEYS = ( PARAM_TIMEOUT, PARAM_DISABLE_ROLLBACK ) = ( diff --git a/heat/rpc/client.py b/heat/rpc/client.py index e9dc26a4b9..7cdae97ee0 100644 --- a/heat/rpc/client.py +++ b/heat/rpc/client.py @@ -18,12 +18,9 @@ Client side of the heat engine RPC API. """ -from oslo.config import cfg - +from heat.engine import api import heat.openstack.common.rpc.proxy -CONF = cfg.CONF - class EngineClient(heat.openstack.common.rpc.proxy.RpcProxy): '''Client side of the heat engine rpc API. @@ -37,7 +34,7 @@ class EngineClient(heat.openstack.common.rpc.proxy.RpcProxy): def __init__(self): super(EngineClient, self).__init__( - topic=CONF.engine_topic, + topic=api.ENGINE_TOPIC, default_version=self.BASE_RPC_API_VERSION) def identify_stack(self, ctxt, stack_name): diff --git a/heat/tests/test_api_cfn_v1.py b/heat/tests/test_api_cfn_v1.py index e6a4f9724f..151893e9d4 100644 --- a/heat/tests/test_api_cfn_v1.py +++ b/heat/tests/test_api_cfn_v1.py @@ -26,6 +26,7 @@ from heat.common import policy from heat.openstack.common import rpc import heat.openstack.common.rpc.common as rpc_common from heat.common.wsgi import Request +from heat.rpc import api as rpc_api from heat.api.aws import exception import heat.api.cfn.v1.stacks as stacks @@ -1406,9 +1407,8 @@ class CfnStackControllerTest(unittest.TestCase): cfg.StrOpt('project', default='heat'), ] cfg.CONF.register_opts(opts) - cfg.CONF.set_default('engine_topic', 'engine') cfg.CONF.set_default('host', 'host') - self.topic = cfg.CONF.engine_topic + self.topic = rpc_api.ENGINE_TOPIC self.api_version = '1.0' # Create WSGI controller instance diff --git a/heat/tests/test_api_cloudwatch.py b/heat/tests/test_api_cloudwatch.py index 107a182264..a237f7a374 100644 --- a/heat/tests/test_api_cloudwatch.py +++ b/heat/tests/test_api_cloudwatch.py @@ -25,7 +25,8 @@ from heat.openstack.common import rpc from heat.common.wsgi import Request from heat.api.aws import exception import heat.api.cloudwatch.watch as watches -from heat.rpc import api as engine_api +from heat.engine import api as engine_api +from heat.rpc import api as rpc_api @attr(tag=['unit', 'api-cloudwatch', 'WatchController']) @@ -520,9 +521,8 @@ class WatchControllerTest(unittest.TestCase): cfg.StrOpt('project', default='heat'), ] cfg.CONF.register_opts(opts) - cfg.CONF.set_default('engine_topic', 'engine') cfg.CONF.set_default('host', 'host') - self.topic = cfg.CONF.engine_topic + self.topic = rpc_api.ENGINE_TOPIC self.api_version = '1.0' # Create WSGI controller instance diff --git a/heat/tests/test_api_openstack_v1.py b/heat/tests/test_api_openstack_v1.py index 678f32d7f7..76909000ac 100644 --- a/heat/tests/test_api_openstack_v1.py +++ b/heat/tests/test_api_openstack_v1.py @@ -26,6 +26,7 @@ from heat.openstack.common import rpc import heat.openstack.common.rpc.common as rpc_common from heat.common.wsgi import Request from heat.common import urlfetch +from heat.rpc import api as rpc_api import heat.api.openstack.v1 as api_v1 import heat.api.openstack.v1.stacks as stacks @@ -158,9 +159,8 @@ class ControllerTest(object): self.maxDiff = None self.m = mox.Mox() - cfg.CONF.set_default('engine_topic', 'engine') cfg.CONF.set_default('host', 'host') - self.topic = cfg.CONF.engine_topic + self.topic = rpc_api.ENGINE_TOPIC self.api_version = '1.0' self.tenant = 't' diff --git a/heat/tests/test_rpc_client.py b/heat/tests/test_rpc_client.py index ec8308a35c..fe42a888f8 100644 --- a/heat/tests/test_rpc_client.py +++ b/heat/tests/test_rpc_client.py @@ -26,6 +26,7 @@ import unittest from heat.common import context from heat.common import identifier +from heat.rpc import api as rpc_api from heat.rpc import client as rpc_client from heat.openstack.common import rpc @@ -38,7 +39,6 @@ class EngineRpcAPITestCase(unittest.TestCase): cfg.CONF.set_default('rpc_backend', 'heat.openstack.common.rpc.impl_fake') cfg.CONF.set_default('verbose', True) - cfg.CONF.set_default('engine_topic', 'engine') cfg.CONF.set_default('host', 'host') self.stubs = stubout.StubOutForTesting() @@ -64,7 +64,7 @@ class EngineRpcAPITestCase(unittest.TestCase): expected_msg = rpcapi.make_msg(method, **kwargs) expected_msg['version'] = expected_version - expected_topic = cfg.CONF.engine_topic + expected_topic = rpc_api.ENGINE_TOPIC cast_and_call = ['delete_stack'] if rpc_method == 'call' and method in cast_and_call: