heat engine : watchrule quietly discard unused metric data

Some cfn-push-stats options try to send multiple metrics to a
watch, which won't work with our simplified CW implementation
which expects exactly one Metric associated with each watch
(since that's all you can define via the template)
So quietly discard any metric data we aren't interested in.

ref bug 1133510

Change-Id: I5159611b96c501ff2d8e6e605cbd3d4ae5f77e48
This commit is contained in:
Steven Hardy 2013-03-06 14:55:12 +00:00
parent 876ec0a728
commit d8ea7394c2
1 changed files with 8 additions and 4 deletions

View File

@ -247,10 +247,14 @@ class WatchRule(object):
def create_watch_data(self, data):
if not self.rule['MetricName'] in data:
logger.warn('new data has incorrect metric:%s' %
(self.rule['MetricName']))
raise ValueError('MetricName %s missing' %
self.rule['MetricName'])
# Our simplified cloudwatch implementation only expects a single
# Metric associated with each alarm, but some cfn-push-stats
# options, e.g --haproxy try to push multiple metrics when we
# actually only care about one (the one we're alarming on)
# so just ignore any data which doesn't contain MetricName
logger.debug('Ignoring metric data (only accept %s) : %s' %
(self.rule['MetricName'], data))
return
watch_data = {
'data': data,