Fix security group ingress authorization for all protocols with no port spec
This commit is contained in:
		
							parent
							
								
									ecbb714757
								
							
						
					
					
						commit
						b32fbf090a
					
				| @ -111,8 +111,12 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """<DescribeSecurityGroupsResponse xmlns="ht | |||||||
|                {% for rule in group.ingress_rules %} |                {% for rule in group.ingress_rules %} | ||||||
|                     <item> |                     <item> | ||||||
|                        <ipProtocol>{{ rule.ip_protocol }}</ipProtocol> |                        <ipProtocol>{{ rule.ip_protocol }}</ipProtocol> | ||||||
|  |                        {% if rule.from_port %} | ||||||
|                        <fromPort>{{ rule.from_port }}</fromPort> |                        <fromPort>{{ rule.from_port }}</fromPort> | ||||||
|  |                        {% endif %} | ||||||
|  |                        {% if rule.to_port %} | ||||||
|                        <toPort>{{ rule.to_port }}</toPort> |                        <toPort>{{ rule.to_port }}</toPort> | ||||||
|  |                        {% endif %} | ||||||
|                        <groups> |                        <groups> | ||||||
|                           {% for source_group in rule.source_groups %} |                           {% for source_group in rule.source_groups %} | ||||||
|                               <item> |                               <item> | ||||||
|  | |||||||
| @ -313,3 +313,16 @@ def test_security_group_tag_filtering(): | |||||||
| 
 | 
 | ||||||
|     groups = conn.get_all_security_groups(filters={"tag:test-tag": "test-value"}) |     groups = conn.get_all_security_groups(filters={"tag:test-tag": "test-value"}) | ||||||
|     groups.should.have.length_of(1) |     groups.should.have.length_of(1) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @mock_ec2 | ||||||
|  | def test_authorize_all_protocols_with_no_port_specification(): | ||||||
|  |     conn = boto.connect_ec2() | ||||||
|  |     sg = conn.create_security_group('test', 'test') | ||||||
|  | 
 | ||||||
|  |     success = sg.authorize(ip_protocol='-1', cidr_ip='0.0.0.0/0') | ||||||
|  |     success.should.be.true | ||||||
|  | 
 | ||||||
|  |     sg = conn.get_all_security_groups('test')[0] | ||||||
|  |     sg.rules[0].from_port.should.equal(None) | ||||||
|  |     sg.rules[0].to_port.should.equal(None) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user