From: Angus Salkeld Date: Mon, 5 Aug 2013 12:46:40 +0000 (+1000) Subject: Add the enabled property to the ceilometer alarm. X-Git-Tag: 2014.1~271^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=428230d828b6df4124c4d33afa932baf612d1f43;p=openstack-build%2Fheat-build.git Add the enabled property to the ceilometer alarm. Change-Id: Ic0f96be74f36884868dad52b0bfe494406e031d9 --- diff --git a/heat/engine/resources/ceilometer/alarm.py b/heat/engine/resources/ceilometer/alarm.py index 1fa014e0..646fd8d7 100644 --- a/heat/engine/resources/ceilometer/alarm.py +++ b/heat/engine/resources/ceilometer/alarm.py @@ -48,6 +48,8 @@ class CeilometerAlarm(resource.Resource): 'insufficient_data_actions': {'Type': 'List'}, 'description': {'Type': 'String'}, 'source': {'Type': 'String'}, + 'enabled': {'Type': 'Boolean', + 'Default': 'true'}, 'matching_metadata': {'Type': 'Map'}} update_allowed_keys = ('Properties',) @@ -57,7 +59,8 @@ class CeilometerAlarm(resource.Resource): update_allowed_properties = ('comparison_operator', 'description', 'evaluation_periods', 'period', 'statistic', 'alarm_actions', 'ok_actions', - 'insufficient_data_actions', 'threshold') + 'insufficient_data_actions', 'threshold', + 'enabled') def _actions_to_urls(self, props): kwargs = {} @@ -82,7 +85,6 @@ class CeilometerAlarm(resource.Resource): def handle_create(self): props = self._actions_to_urls(self.parsed_template('Properties')) props['name'] = self.physical_resource_name() - props['enabled'] = True alarm = self.ceilometer().alarms.create(**props) self.resource_id_set(alarm.alarm_id) diff --git a/heat/tests/test_ceilometer_alarm.py b/heat/tests/test_ceilometer_alarm.py index d47b77a4..141df1fc 100644 --- a/heat/tests/test_ceilometer_alarm.py +++ b/heat/tests/test_ceilometer_alarm.py @@ -121,7 +121,6 @@ class CeilometerAlarmTest(HeatTestCase): al = copy.deepcopy(temp['Resources']['MEMAlarmHigh']['Properties']) al['description'] = mox.IgnoreArg() - al['enabled'] = mox.IgnoreArg() al['name'] = mox.IgnoreArg() al['alarm_actions'] = mox.IgnoreArg() self.m.StubOutWithMock(self.fa.alarms, 'create') @@ -158,6 +157,7 @@ class CeilometerAlarmTest(HeatTestCase): snippet['Properties']['description'] = 'fruity' snippet['Properties']['evaluation_periods'] = '2' snippet['Properties']['period'] = '90' + snippet['Properties']['enabled'] = 'true' snippet['Properties']['statistic'] = 'max' snippet['Properties']['threshold'] = '39' snippet['Properties']['insufficient_data_actions'] = []