Recongnize None and -1 port equivalency

shade 0.7.0 represents disabled min/max ports as None (in the
neutron style) rather than -1. Recognize this as the same as -1.
pull/18777/head
David Shrewsbury 10 years ago committed by Matt Clay
parent b42a9d56e6
commit fcc1d643f6

@ -89,9 +89,12 @@ def _security_group_rule(module, nova_client, action='create', **kwargs):
def _get_rule_from_group(module, secgroup): def _get_rule_from_group(module, secgroup):
for rule in secgroup['security_group_rules']: for rule in secgroup['security_group_rules']:
# No port, or -1, will be returned as None
port_range_min = rule['port_range_min'] or -1
port_range_max = rule['port_range_max'] or -1
if (rule['protocol'] == module.params['protocol'] and if (rule['protocol'] == module.params['protocol'] and
rule['port_range_min'] == module.params['port_range_min'] and port_range_min == module.params['port_range_min'] and
rule['port_range_max'] == module.params['port_range_max'] and port_range_max == module.params['port_range_max'] and
rule['remote_ip_prefix'] == module.params['remote_ip_prefix']): rule['remote_ip_prefix'] == module.params['remote_ip_prefix']):
return rule return rule
return None return None

Loading…
Cancel
Save