Return an iterable instead of None

By default `.get()` will return `None` on a key that doesn't exist. This
causes a `TypeError` in the `for` loop a few lines down. This change simply
returns an iterable type to avoid the error.
This commit is contained in:
Michael J. Schultz 2015-08-12 12:13:29 -05:00 committed by Matt Clay
parent fe840225fb
commit c7eb08b217

View file

@ -184,7 +184,7 @@ def create_metric_alarm(connection, module):
comparisons = {'<=' : 'LessThanOrEqualToThreshold', '<' : 'LessThanThreshold', '>=' : 'GreaterThanOrEqualToThreshold', '>' : 'GreaterThanThreshold'} comparisons = {'<=' : 'LessThanOrEqualToThreshold', '<' : 'LessThanThreshold', '>=' : 'GreaterThanOrEqualToThreshold', '>' : 'GreaterThanThreshold'}
alarm.comparison = comparisons[comparison] alarm.comparison = comparisons[comparison]
dim1 = module.params.get('dimensions') dim1 = module.params.get('dimensions', {})
dim2 = alarm.dimensions dim2 = alarm.dimensions
for keys in dim1: for keys in dim1: