Merge pull request #1120 from JackDanger/jack/rendering-vpc_id-in-ec2-responses
rendering vpc_id in ec2 responses
This commit is contained in:
commit
49035d3477
@ -255,17 +255,19 @@ EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc
|
||||
<monitoring>
|
||||
<state>enabled</state>
|
||||
</monitoring>
|
||||
{% if instance.nics %}
|
||||
{% if instance.nics[0].subnet %}
|
||||
<subnetId>{{ instance.nics[0].subnet.id }}</subnetId>
|
||||
<vpcId>{{ instance.nics[0].subnet.vpc_id }}</vpcId>
|
||||
{% endif %}
|
||||
<privateIpAddress>{{ instance.private_ip }}</privateIpAddress>
|
||||
{% if instance.public_ip %}
|
||||
<ipAddress>{{ instance.public_ip }}</ipAddress>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if instance.subnet_id %}
|
||||
<subnetId>{{ instance.subnet_id }}</subnetId>
|
||||
{% elif instance.nics[0].subnet.id %}
|
||||
<subnetId>{{ instance.nics[0].subnet.id }}</subnetId>
|
||||
{% endif %}
|
||||
{% if instance.vpc_id %}
|
||||
<vpcId>{{ instance.vpc_id }}</vpcId>
|
||||
{% elif instance.nics[0].subnet.vpc_id %}
|
||||
<vpcId>{{ instance.nics[0].subnet.vpc_id }}</vpcId>
|
||||
{% endif %}
|
||||
<privateIpAddress>{{ instance.private_ip }}</privateIpAddress>
|
||||
{% if instance.nics[0].public_ip %}
|
||||
<ipAddress>{{ instance.nics[0].public_ip }}</ipAddress>
|
||||
{% endif %}
|
||||
<sourceDestCheck>{{ instance.source_dest_check }}</sourceDestCheck>
|
||||
<groupSet>
|
||||
@ -396,26 +398,30 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
||||
<monitoring>
|
||||
<state>disabled</state>
|
||||
</monitoring>
|
||||
{% if instance.nics %}
|
||||
{% if instance.nics[0].subnet %}
|
||||
<subnetId>{{ instance.nics[0].subnet.id }}</subnetId>
|
||||
<vpcId>{{ instance.nics[0].subnet.vpc_id }}</vpcId>
|
||||
{% endif %}
|
||||
<privateIpAddress>{{ instance.private_ip }}</privateIpAddress>
|
||||
{% if instance.nics[0].public_ip %}
|
||||
<ipAddress>{{ instance.nics[0].public_ip }}</ipAddress>
|
||||
{% endif %}
|
||||
{% if instance.subnet_id %}
|
||||
<subnetId>{{ instance.subnet_id }}</subnetId>
|
||||
{% elif instance.nics[0].subnet.id %}
|
||||
<subnetId>{{ instance.nics[0].subnet.id }}</subnetId>
|
||||
{% endif %}
|
||||
{% if instance.vpc_id %}
|
||||
<vpcId>{{ instance.vpc_id }}</vpcId>
|
||||
{% elif instance.nics[0].subnet.vpc_id %}
|
||||
<vpcId>{{ instance.nics[0].subnet.vpc_id }}</vpcId>
|
||||
{% endif %}
|
||||
<privateIpAddress>{{ instance.private_ip }}</privateIpAddress>
|
||||
{% if instance.nics[0].public_ip %}
|
||||
<ipAddress>{{ instance.nics[0].public_ip }}</ipAddress>
|
||||
{% endif %}
|
||||
<sourceDestCheck>{{ instance.source_dest_check }}</sourceDestCheck>
|
||||
<groupSet>
|
||||
{% for group in instance.dynamic_group_list %}
|
||||
<item>
|
||||
{% if group.id %}
|
||||
<groupId>{{ group.id }}</groupId>
|
||||
<groupName>{{ group.name }}</groupName>
|
||||
{% else %}
|
||||
<groupId>{{ group }}</groupId>
|
||||
{% endif %}
|
||||
{% if group.id %}
|
||||
<groupId>{{ group.id }}</groupId>
|
||||
<groupName>{{ group.name }}</groupName>
|
||||
{% else %}
|
||||
<groupId>{{ group }}</groupId>
|
||||
{% endif %}
|
||||
</item>
|
||||
{% endfor %}
|
||||
</groupSet>
|
||||
|
@ -378,11 +378,15 @@ def test_get_instances_filtering_by_vpc_id():
|
||||
reservations1.should.have.length_of(1)
|
||||
reservations1[0].instances.should.have.length_of(1)
|
||||
reservations1[0].instances[0].id.should.equal(instance1.id)
|
||||
reservations1[0].instances[0].vpc_id.should.equal(vpc1.id)
|
||||
reservations1[0].instances[0].subnet_id.should.equal(subnet1.id)
|
||||
|
||||
reservations2 = conn.get_all_instances(filters={'vpc-id': vpc2.id})
|
||||
reservations2.should.have.length_of(1)
|
||||
reservations2[0].instances.should.have.length_of(1)
|
||||
reservations2[0].instances[0].id.should.equal(instance2.id)
|
||||
reservations2[0].instances[0].vpc_id.should.equal(vpc2.id)
|
||||
reservations2[0].instances[0].subnet_id.should.equal(subnet2.id)
|
||||
|
||||
|
||||
@mock_ec2_deprecated
|
||||
@ -876,7 +880,6 @@ def test_run_instance_with_nic_autocreated():
|
||||
eni.private_ip_addresses.should.have.length_of(1)
|
||||
eni.private_ip_addresses[0].private_ip_address.should.equal(private_ip)
|
||||
|
||||
|
||||
@mock_ec2_deprecated
|
||||
def test_run_instance_with_nic_preexisting():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
Loading…
Reference in New Issue
Block a user