From c7eb08b217a77303373e7d4db2b5a3fa238f05bf 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. --- lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py b/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py index 305bec27426..5508f2e3029 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_metric_alarm.py +++ b/lib/ansible/modules/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: