From f9e94b18a2b5721a49839c65d24608c42a5734f0 Mon Sep 17 00:00:00 2001 From: Swann Croiset Date: Mon, 16 Sep 2013 11:55:43 +0200 Subject: [PATCH] Add 'repeat_actions' property for OS::Ceilometer::Alarm The default value is maintained : repeat_actions=False Require python-ceilometerclient>=1.0.3 Fixes bug #1223347 Change-Id: I010b6555311e9e34b095d9216cf1c5873e244cc4 --- heat/engine/resources/ceilometer/alarm.py | 14 ++++++++++++-- heat/tests/test_ceilometer_alarm.py | 1 + requirements.txt | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/heat/engine/resources/ceilometer/alarm.py b/heat/engine/resources/ceilometer/alarm.py index 5a2a19d03..60a2aeab2 100644 --- a/heat/engine/resources/ceilometer/alarm.py +++ b/heat/engine/resources/ceilometer/alarm.py @@ -78,6 +78,15 @@ class CeilometerAlarm(resource.Resource): 'Default': 'true', 'Description': _('True if alarm evaluation/actioning is enabled') }, + 'repeat_actions': { + 'Type': 'Boolean', + 'Default': 'false', + 'Description': _('True to trigger actions each time the threshold ' + 'is reached. ' + 'By default, actions are called when : ' + 'the threshold is reached AND the alarm\'s state ' + 'have changed') + }, 'matching_metadata': { 'Type': 'Map', 'Description': _('Counter should match this resource metadata ' @@ -93,12 +102,13 @@ class CeilometerAlarm(resource.Resource): 'evaluation_periods', 'period', 'statistic', 'alarm_actions', 'ok_actions', 'insufficient_data_actions', 'threshold', - 'enabled') + 'enabled', 'repeat_actions') def _actions_to_urls(self, props): kwargs = {} for k, v in iter(props.items()): - if k.endswith('_actions') and v is not None: + if k in ['alarm_actions', 'ok_actions', + 'insufficient_data_actions'] and v is not None: kwargs[k] = [] for act in v: # if the action is a resource name diff --git a/heat/tests/test_ceilometer_alarm.py b/heat/tests/test_ceilometer_alarm.py index 2a892fb3a..21e873d97 100644 --- a/heat/tests/test_ceilometer_alarm.py +++ b/heat/tests/test_ceilometer_alarm.py @@ -157,6 +157,7 @@ class CeilometerAlarmTest(HeatTestCase): snippet['Properties']['evaluation_periods'] = '2' snippet['Properties']['period'] = '90' snippet['Properties']['enabled'] = 'true' + snippet['Properties']['repeat_actions'] = True snippet['Properties']['statistic'] = 'max' snippet['Properties']['threshold'] = '39' snippet['Properties']['insufficient_data_actions'] = [] diff --git a/requirements.txt b/requirements.txt index 0a38879f9..e32ba9be2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,7 @@ WebOb>=1.2.3,<1.3 python-keystoneclient>=0.3.2 python-swiftclient>=1.2 python-neutronclient>=2.3.0,<3 -python-ceilometerclient>=1.0.2 +python-ceilometerclient>=1.0.3 python-cinderclient>=1.0.4 PyYAML>=3.1.0 paramiko>=1.8.0