From 269c06a4c9b5f842e508fbe16d956e6c901896ac 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) --- cloud/amazon/ec2_group.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cloud/amazon/ec2_group.py b/cloud/amazon/ec2_group.py index 4e05b7219b4..919edfae9b0 100644 --- a/cloud/amazon/ec2_group.py +++ b/cloud/amazon/ec2_group.py @@ -163,6 +163,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))