Add ebs_optimized parameter to launch configurations

This commit is contained in:
Steve Pulec 2013-09-10 16:54:57 -04:00
parent dc2802a238
commit afad0bed14
3 changed files with 11 additions and 3 deletions

View File

@ -29,7 +29,7 @@ class FakeScalingPolicy(object):
class FakeLaunchConfiguration(object):
def __init__(self, name, image_id, key_name, security_groups, user_data,
instance_type, instance_monitoring, instance_profile_name,
spot_price):
spot_price, ebs_optimized):
self.name = name
self.image_id = image_id
self.key_name = key_name
@ -39,6 +39,7 @@ class FakeLaunchConfiguration(object):
self.instance_monitoring = instance_monitoring
self.instance_profile_name = instance_profile_name
self.spot_price = spot_price
self.ebs_optimized = ebs_optimized
@property
def instance_monitoring_enabled(self):
@ -126,7 +127,7 @@ class AutoScalingBackend(BaseBackend):
def create_launch_configuration(self, name, image_id, key_name,
security_groups, user_data, instance_type,
instance_monitoring, instance_profile_name,
spot_price):
spot_price, ebs_optimized):
launch_configuration = FakeLaunchConfiguration(
name=name,
image_id=image_id,
@ -137,6 +138,7 @@ class AutoScalingBackend(BaseBackend):
instance_monitoring=instance_monitoring,
instance_profile_name=instance_profile_name,
spot_price=spot_price,
ebs_optimized=ebs_optimized,
)
self.launch_configurations[name] = launch_configuration
return launch_configuration

View File

@ -33,6 +33,7 @@ class AutoScalingResponse(BaseResponse):
instance_monitoring=instance_monitoring,
instance_profile_name=self._get_param('IamInstanceProfile'),
spot_price=self._get_param('SpotPrice'),
ebs_optimized=self._get_param('EbsOptimized'),
)
template = Template(CREATE_LAUNCH_CONFIGURATION_TEMPLATE)
return template.render()
@ -178,6 +179,7 @@ DESCRIBE_LAUNCH_CONFIGURATIONS_TEMPLATE = """<DescribeLaunchConfigurationsRespon
<KeyName/>
{% endif %}
<RamdiskId/>
<EbsOptimized>{{ launch_configuration.ebs_optimized }}</EbsOptimized>
<InstanceMonitoring>
<Enabled>{{ launch_configuration.instance_monitoring_enabled }}</Enabled>
</InstanceMonitoring>

View File

@ -18,7 +18,9 @@ def test_create_launch_configuration():
user_data="This is some user_data",
instance_monitoring=True,
instance_profile_name='arn:aws:iam::123456789012:instance-profile/testing',
spot_price=0.1)
spot_price=0.1,
ebs_optimized=True,
)
conn.create_launch_configuration(config)
launch_config = conn.get_all_launch_configurations()[0]
@ -31,6 +33,7 @@ def test_create_launch_configuration():
launch_config.instance_monitoring.enabled.should.equal('true')
launch_config.instance_profile_name.should.equal('arn:aws:iam::123456789012:instance-profile/testing')
launch_config.spot_price.should.equal(0.1)
launch_config.ebs_optimized.should.equal(True)
@mock_autoscaling
@ -57,6 +60,7 @@ def test_create_launch_configuration_defaults():
launch_config.instance_monitoring.enabled.should.equal('false')
launch_config.instance_profile_name.should.equal(None)
launch_config.spot_price.should.equal(None)
launch_config.ebs_optimized.should.equal(False)
@mock_autoscaling