From 3cb42fc5dda1aa5aa8fab3010953581914dd52f2 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Fri, 2 Sep 2016 15:09:58 -0400 Subject: [PATCH] Fix for validate rule. Ensure rule is a dict. (#4640) --- lib/ansible/modules/cloud/amazon/ec2_group.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/modules/cloud/amazon/ec2_group.py b/lib/ansible/modules/cloud/amazon/ec2_group.py index b2adb01383..d6a7d0938b 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_group.py +++ b/lib/ansible/modules/cloud/amazon/ec2_group.py @@ -167,6 +167,10 @@ def validate_rule(module, rule): VALID_PARAMS = ('cidr_ip', 'group_id', 'group_name', 'group_desc', 'proto', 'from_port', 'to_port') + + if not isinstance(rule, dict): + module.fail_json(msg='Invalid rule parameter type [%s].' % type(rule)) + for k in rule: if k not in VALID_PARAMS: module.fail_json(msg='Invalid rule parameter \'{}\''.format(k))