Add instance_id to spot instance requests. Closes #210.

This commit is contained in:
Steve Pulec 2014-10-05 22:55:36 -04:00
parent 68097f63d0
commit b82507e41b
2 changed files with 17 additions and 0 deletions

View File

@ -96,6 +96,7 @@ REQUEST_SPOT_INSTANCES_TEMPLATE = """<RequestSpotInstancesResponse xmlns="http:/
<updateTime>YYYY-MM-DDTHH:MM:SS.000Z</updateTime>
<message>Your Spot request has been submitted for review, and is pending evaluation.</message>
</status>
<instanceId>{{ request.instance_id }}</instanceId>
<availabilityZoneGroup>{{ request.availability_zone_group }}</availabilityZoneGroup>
<launchSpecification>
<imageId>{{ request.launch_specification.image_id }}</imageId>
@ -150,6 +151,7 @@ DESCRIBE_SPOT_INSTANCES_TEMPLATE = """<DescribeSpotInstanceRequestsResponse xmln
<updateTime>YYYY-MM-DDTHH:MM:SS.000Z</updateTime>
<message>Your Spot request has been submitted for review, and is pending evaluation.</message>
</status>
<instanceId>{{ request.instance_id }}</instanceId>
{% if request.availability_zone_group %}
<availabilityZoneGroup>{{ request.availability_zone_group }}</availabilityZoneGroup>
{% endif %}

View File

@ -180,3 +180,18 @@ def test_get_all_spot_instance_requests_filtering():
requests = conn.get_all_spot_instance_requests(filters={'tag:tag1' : 'value1', 'tag:tag2' : 'value2'})
requests.should.have.length_of(1)
@mock_ec2
def test_request_spot_instances_setting_instance_id():
conn = boto.connect_ec2()
request = conn.request_spot_instances(
price=0.5, image_id='ami-abcd1234')
req = get_model('SpotInstanceRequest')[0]
req.state = 'active'
req.instance_id = 'i-12345678'
request = conn.get_all_spot_instance_requests()[0]
assert request.state == 'active'
assert request.instance_id == 'i-12345678'