Don't enforce a kind of alarm rules

Now, the alarm rules are extendable with stevedore in ceilometer API,
so we should not enforce the list of supported alarm rule.

This change does that.

Change-Id: I06067bdd02cf88f6fd4cd060bdfa310ded504e65
This commit is contained in:
Mehdi Abaakouk
2015-02-06 09:59:07 +01:00
parent 2d71a4d66d
commit a51d3f469b

View File

@@ -31,8 +31,6 @@ UPDATABLE_ATTRIBUTES = [
'ok_actions',
'insufficient_data_actions',
'repeat_actions',
'threshold_rule',
'combination_rule',
]
CREATION_ATTRIBUTES = UPDATABLE_ATTRIBUTES + ['project_id', 'user_id',
'time_constraints']
@@ -150,7 +148,8 @@ class AlarmManager(base.Manager):
def create(self, **kwargs):
self._compat_legacy_alarm_kwargs(kwargs, create=True)
new = dict((key, value) for (key, value) in kwargs.items()
if key in CREATION_ATTRIBUTES)
if (key in CREATION_ATTRIBUTES
or key.endswith('_rule')))
return self._create(self._path(), new)
def update(self, alarm_id, **kwargs):
@@ -162,7 +161,8 @@ class AlarmManager(base.Manager):
updated['time_constraints'] = self._merge_time_constraints(
updated.get('time_constraints', []), kwargs)
kwargs = dict((k, v) for k, v in kwargs.items()
if k in updated and k in UPDATABLE_ATTRIBUTES)
if k in updated and (k in UPDATABLE_ATTRIBUTES
or k.endswith('_rule')))
utils.merge_nested_dict(updated, kwargs, depth=1)
return self._update(self._path(alarm_id), updated)