From 63d7bbea19442fa98bd64b20a779d5923745891d Mon Sep 17 00:00:00 2001 From: "Michael J. Schultz" Date: Wed, 12 Aug 2015 12:13:29 -0500 Subject: [PATCH] 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. --- cloud/amazon/ec2_metric_alarm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud/amazon/ec2_metric_alarm.py b/cloud/amazon/ec2_metric_alarm.py index 578a1af7297..b9ac1524794 100644 --- a/cloud/amazon/ec2_metric_alarm.py +++ b/cloud/amazon/ec2_metric_alarm.py @@ -184,7 +184,7 @@ def create_metric_alarm(connection, module): comparisons = {'<=' : 'LessThanOrEqualToThreshold', '<' : 'LessThanThreshold', '>=' : 'GreaterThanOrEqualToThreshold', '>' : 'GreaterThanThreshold'} alarm.comparison = comparisons[comparison] - dim1 = module.params.get('dimensions') + dim1 = module.params.get('dimensions', {}) dim2 = alarm.dimensions for keys in dim1: