From bbf29137282769f6c96123fe92babe41ea64e625 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Thu, 7 May 2015 17:00:16 -0400 Subject: [PATCH] Disable cloud-watch-lite by default This has been deprecated for years and is incompatible with deploying multiple heat-engine processes. Let's at least not turn it on by default. Change-Id: Iabddbd65be9000a30a5714b26658ea6acea0e103 --- heat/common/config.py | 2 +- heat/tests/common.py | 27 +++++++++++++++------------ heat/tests/test_cloudwatch.py | 15 ++++++++++++++- heat/tests/test_engine_service.py | 1 - 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/heat/common/config.py b/heat/common/config.py index 179c55794c..a2b1e37b5e 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -149,7 +149,7 @@ engine_opts = [ help=_('RPC timeout for the engine liveness check that is used' ' for stack locking.')), cfg.BoolOpt('enable_cloud_watch_lite', - default=True, + default=False, help=_('Enable the legacy OS::Heat::CWLiteAlarm resource.')), cfg.BoolOpt('enable_stack_abandon', default=False, diff --git a/heat/tests/common.py b/heat/tests/common.py index 7fe4daa91f..9690dd720f 100644 --- a/heat/tests/common.py +++ b/heat/tests/common.py @@ -100,19 +100,22 @@ class HeatTestCase(testscenarios.WithScenarios, messaging.setup("fake://", optional=True) self.addCleanup(messaging.cleanup) - tri = resources.global_env().get_resource_info( - 'AWS::RDS::DBInstance', - registry_type=environment.TemplateResourceInfo) - if tri is not None: - cur_path = tri.template_name - templ_path = os.path.join(project_dir, 'etc', 'heat', 'templates') - if templ_path not in cur_path: - tri.template_name = cur_path.replace('/etc/heat/templates', - templ_path) + tri_names = ['AWS::RDS::DBInstance', 'AWS::CloudWatch::Alarm'] + tris = [] + for name in tri_names: + tris.append(resources.global_env().get_resource_info( + name, + registry_type=environment.TemplateResourceInfo)) + for tri in tris: + if tri is not None: + cur_path = tri.template_name + templ_path = os.path.join(project_dir, 'etc', + 'heat', 'templates') + if templ_path not in cur_path: + tri.template_name = cur_path.replace( + '/etc/heat/templates', + templ_path) - # use CWLiteAlarm for testing. - resources.global_env().registry.load( - {"AWS::CloudWatch::Alarm": "OS::Heat::CWLiteAlarm"}) if mock_keystone: self.stub_keystoneclient() utils.setup_dummy_db() diff --git a/heat/tests/test_cloudwatch.py b/heat/tests/test_cloudwatch.py index aa5bf5024f..875c0aaff7 100644 --- a/heat/tests/test_cloudwatch.py +++ b/heat/tests/test_cloudwatch.py @@ -15,6 +15,8 @@ import mock from heat.common import exception from heat.common import template_format +from heat.engine import resource +from heat.engine import resources from heat.engine.resources.openstack.heat import cloud_watch from heat.engine import scheduler from heat.engine import watchrule @@ -43,11 +45,22 @@ class CloudWatchAlarmTest(common.HeatTestCase): def setUp(self): super(CloudWatchAlarmTest, self).setUp() + + def clear_register_class(): + env = resources.global_env() + env.registry._registry.pop('CWLiteAlarmForTest') + self.ctx = utils.dummy_context() + resource._register_class('CWLiteAlarmForTest', + cloud_watch.CloudWatchAlarm) + self.addCleanup(clear_register_class) def parse_stack(self): t = template_format.parse(AWS_CloudWatch_Alarm) - self.stack = utils.parse_stack(t) + env = {'resource_registry': { + 'AWS::CloudWatch::Alarm': 'CWLiteAlarmForTest' + }} + self.stack = utils.parse_stack(t, params=env) return self.stack def test_resource_create_good(self): diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py index 2ec775e657..465a930ab9 100644 --- a/heat/tests/test_engine_service.py +++ b/heat/tests/test_engine_service.py @@ -2279,7 +2279,6 @@ class StackServiceTest(common.HeatTestCase): def test_list_resource_types_deprecated(self): resources = self.eng.list_resource_types(self.ctx, "DEPRECATED") self.assertEqual(set(['OS::Neutron::RouterGateway', - 'OS::Heat::CWLiteAlarm', 'OS::Heat::HARestarter', 'OS::Heat::SoftwareDeployments', 'OS::Heat::StructuredDeployments']),