mirror of
				https://github.com/ansible-collections/community.general.git
				synced 2024-09-14 20:13:21 +02:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									b42a9d56e6
								
							
						
					
					
						commit
						fcc1d643f6
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue