Add support for new alarm repeat_actions attribute

Continuous notification is generally required by Heat.

Change-Id: Ib396f47c68298f883e305c755d821c2679a56a5c
This commit is contained in:
Eoghan Glynn
2013-08-08 15:01:21 +00:00
parent 091937b9a2
commit e8bf783d6a
3 changed files with 11 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ AN_ALARM = {u'alarm_actions': [u'http://site:8000/alarm'],
u'project_id': u'project-id',
u'state_timestamp': u'2013-05-09T13:41:23.085000',
u'comparison_operator': 'gt',
u'repeat_actions': False,
u'name': 'SwiftObjectAlarm'}
CREATE_ALARM = copy.deepcopy(AN_ALARM)
del CREATE_ALARM['timestamp']

View File

@@ -33,6 +33,7 @@ UPDATABLE_ATTRIBUTES = [
'alarm_actions',
'ok_actions',
'insufficient_data_actions',
'repeat_actions',
'matching_metadata',
]
CREATION_ATTRIBUTES = UPDATABLE_ATTRIBUTES + ['name', 'project_id', 'user_id']

View File

@@ -148,7 +148,7 @@ def _display_alarm(alarm):
'evaluation_periods', 'threshold', 'comparison_operator',
'state', 'enabled', 'alarm_id', 'user_id', 'project_id',
'alarm_actions', 'ok_actions', 'insufficient_data_actions',
'matching_metadata']
'repeat_actions', 'matching_metadata']
data = dict([(f, getattr(alarm, f, '')) for f in fields])
utils.print_dict(data, wrap=72)
@@ -205,6 +205,10 @@ def do_alarm_show(cc, args={}):
metavar='<Webhook URL>', action='append', default=None,
help=('URL to invoke when state transitions to unkown. '
'May be used multiple times.'))
@utils.arg('--repeat-actions', dest='repeat_actions', metavar='{True|False}',
type=utils.string_to_bool, default=False,
help=('True if actions should be repeatedly notified '
'while alarm remains in target state'))
@utils.arg('--matching-metadata', dest='matching_metadata',
metavar='<Matching Metadata>', action='append', default=None,
help=('A meter should match this resource metadata (key=value) '
@@ -249,6 +253,10 @@ def do_alarm_create(cc, args={}):
metavar='<Webhook URL>', action='append', default=None,
help=('URL to invoke when state transitions to unkown. '
'May be used multiple times.'))
@utils.arg('--repeat-actions', dest='repeat_actions',
metavar='{True|False}', type=utils.string_to_bool,
help=('True if actions should be repeatedly notified '
'while alarm remains in target state'))
@utils.arg('--matching-metadata', dest='matching_metadata',
metavar='<Matching Metadata>', action='append', default=None,
help=('A meter should match this resource metadata (key=value) '