]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Add 'repeat_actions' property for OS::Ceilometer::Alarm
authorSwann Croiset <swann.croiset@bull.net>
Mon, 16 Sep 2013 09:55:43 +0000 (11:55 +0200)
committerSwann Croiset <swann.croiset@bull.net>
Wed, 18 Sep 2013 10:35:18 +0000 (12:35 +0200)
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
heat/tests/test_ceilometer_alarm.py
requirements.txt

index 5a2a19d0383f748dfd59f03398e2d2aae8567e89..60a2aeab276386d4f54a7c2676833456ede921c9 100644 (file)
@@ -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
index 2a892fb3a23899cb0cb53d83f218039e13d82c25..21e873d9781b97adf6cc199c2239b604a62cff45 100644 (file)
@@ -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'] = []
index 0a38879f9bf8eae7b006ca05f789b63eaad1109d..e32ba9be288abd9c3e2094e3a0e9987924265b42 100644 (file)
@@ -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