From fcc1d643f67c7c7b2433bfe55ecd961c87279df6 Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Wed, 10 Jun 2015 18:06:11 -0400 Subject: [PATCH] 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. --- .../modules/cloud/openstack/os_security_group_rule.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/openstack/os_security_group_rule.py b/lib/ansible/modules/cloud/openstack/os_security_group_rule.py index 3785789ec62..43e9f104115 100644 --- a/lib/ansible/modules/cloud/openstack/os_security_group_rule.py +++ b/lib/ansible/modules/cloud/openstack/os_security_group_rule.py @@ -89,9 +89,12 @@ def _security_group_rule(module, nova_client, action='create', **kwargs): def _get_rule_from_group(module, secgroup): 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 - rule['port_range_min'] == module.params['port_range_min'] and - rule['port_range_max'] == module.params['port_range_max'] and + port_range_min == module.params['port_range_min'] and + port_range_max == module.params['port_range_max'] and rule['remote_ip_prefix'] == module.params['remote_ip_prefix']): return rule return None