Fix for validate rule. Ensure rule is a dict. (#4640)
This commit is contained in:
parent
f7b34c810a
commit
269c06a4c9
1 changed files with 4 additions and 0 deletions
|
@ -163,6 +163,10 @@ def validate_rule(module, rule):
|
||||||
VALID_PARAMS = ('cidr_ip',
|
VALID_PARAMS = ('cidr_ip',
|
||||||
'group_id', 'group_name', 'group_desc',
|
'group_id', 'group_name', 'group_desc',
|
||||||
'proto', 'from_port', 'to_port')
|
'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:
|
for k in rule:
|
||||||
if k not in VALID_PARAMS:
|
if k not in VALID_PARAMS:
|
||||||
module.fail_json(msg='Invalid rule parameter \'{}\''.format(k))
|
module.fail_json(msg='Invalid rule parameter \'{}\''.format(k))
|
||||||
|
|
Loading…
Reference in a new issue