Compare ports as strings
Ports as returned from shade are ints. They are strings as they come in to the module.
This commit is contained in:
parent
14212c37e2
commit
e7dd93c5c1
1 changed files with 10 additions and 2 deletions
|
@ -105,8 +105,16 @@ def _find_matching_rule(module, secgroup):
|
||||||
|
|
||||||
for rule in secgroup['security_group_rules']:
|
for rule in secgroup['security_group_rules']:
|
||||||
# No port, or -1, will be returned from shade as None
|
# No port, or -1, will be returned from shade as None
|
||||||
rule_port_range_min = rule['port_range_min'] or -1
|
if rule['port_range_min'] is None:
|
||||||
rule_port_range_max = rule['port_range_max'] or -1
|
rule_port_range_min = "-1"
|
||||||
|
else:
|
||||||
|
rule_port_range_min = str(rule['port_range_min'])
|
||||||
|
|
||||||
|
if rule['port_range_max'] is None:
|
||||||
|
rule_port_range_max = "-1"
|
||||||
|
else:
|
||||||
|
rule_port_range_max = str(rule['port_range_max'])
|
||||||
|
|
||||||
|
|
||||||
if (protocol == rule['protocol']
|
if (protocol == rule['protocol']
|
||||||
and port_range_min == rule_port_range_min
|
and port_range_min == rule_port_range_min
|
||||||
|
|
Loading…
Reference in a new issue