parent
098dd3fa1c
commit
f3623e3cd3
@ -30,7 +30,7 @@ class InstanceResponse(BaseResponse):
|
||||
if max_results and len(reservations) > (start + max_results):
|
||||
next_token = reservations_resp[-1].id
|
||||
template = self.response_template(EC2_DESCRIBE_INSTANCES)
|
||||
return template.render(reservations=reservations_resp, next_token=next_token)
|
||||
return template.render(reservations=reservations_resp, next_token=next_token).replace('True', 'true').replace('False', 'false')
|
||||
|
||||
def run_instances(self):
|
||||
min_count = int(self._get_param('MinCount', if_none='1'))
|
||||
@ -144,7 +144,12 @@ class InstanceResponse(BaseResponse):
|
||||
"""
|
||||
Handles requests which are generated by code similar to:
|
||||
|
||||
instance.modify_attribute('blockDeviceMapping', {'/dev/sda1': True})
|
||||
instance.modify_attribute(
|
||||
BlockDeviceMappings=[{
|
||||
'DeviceName': '/dev/sda1',
|
||||
'Ebs': {'DeleteOnTermination': True}
|
||||
}]
|
||||
)
|
||||
|
||||
The querystring contains information similar to:
|
||||
|
||||
|
@ -1113,3 +1113,20 @@ def test_get_instance_by_security_group():
|
||||
|
||||
assert len(security_group_instances) == 1
|
||||
assert security_group_instances[0].id == instance.id
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_modify_delete_on_termination():
|
||||
ec2_client = boto3.resource('ec2', region_name='us-west-1')
|
||||
result = ec2_client.create_instances(ImageId='ami-12345678', MinCount=1, MaxCount=1)
|
||||
instance = result[0]
|
||||
instance.load()
|
||||
instance.block_device_mappings[0]['Ebs']['DeleteOnTermination'].should.be(False)
|
||||
instance.modify_attribute(
|
||||
BlockDeviceMappings=[{
|
||||
'DeviceName': '/dev/sda1',
|
||||
'Ebs': {'DeleteOnTermination': True}
|
||||
}]
|
||||
)
|
||||
instance.load()
|
||||
instance.block_device_mappings[0]['Ebs']['DeleteOnTermination'].should.be(True)
|
||||
|
Loading…
Reference in New Issue
Block a user