summaryrefslogtreecommitdiff
path: root/boto/ec2/autoscale/launchconfig.py
diff options
context:
space:
mode:
authorAndrew Gross <andrew.w.gross@gmail.com>2014-03-06 16:48:52 -0500
committerAndrew Gross <andrew.w.gross@gmail.com>2014-03-06 16:48:52 -0500
commitea4a3af5bae64c6993e7211cbe22315137c7331d (patch)
treeea49b3d8eb6ec0beb238a665504d9940392f4456 /boto/ec2/autoscale/launchconfig.py
parent0f359246797ff3f872e1b76bc7679f4ec49be24e (diff)
downloadboto-ea4a3af5bae64c6993e7211cbe22315137c7331d.tar.gz
Fix BlockDeviceType deserialization in `get_all_launch_configurations`
* Add switch to remove deserialize API response to proper objects * Preserve backwards compatible behavior * Add test for new behavior * Add documentation of new switch
Diffstat (limited to 'boto/ec2/autoscale/launchconfig.py')
-rw-r--r--boto/ec2/autoscale/launchconfig.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/boto/ec2/autoscale/launchconfig.py b/boto/ec2/autoscale/launchconfig.py
index 5a887bf3..9c3c8996 100644
--- a/boto/ec2/autoscale/launchconfig.py
+++ b/boto/ec2/autoscale/launchconfig.py
@@ -21,14 +21,16 @@
# IN THE SOFTWARE.
from datetime import datetime
-from boto.resultset import ResultSet
from boto.ec2.elb.listelement import ListElement
+# Namespacing issue with deprecated local class
+from boto.ec2.blockdevicemapping import BlockDeviceMapping as BDM
+from boto.resultset import ResultSet
import boto.utils
import base64
-# this should use the corresponding object from boto.ec2
-
+# this should use the corresponding object from boto.ec2
+# Currently in use by deprecated local BlockDeviceMapping class
class Ebs(object):
def __init__(self, connection=None, snapshot_id=None, volume_size=None):
self.connection = connection
@@ -65,6 +67,8 @@ class InstanceMonitoring(object):
# this should use the BlockDeviceMapping from boto.ec2.blockdevicemapping
+# Currently in use by deprecated code for backwards compatability
+# Removing this class can also remove the Ebs class in this same file
class BlockDeviceMapping(object):
def __init__(self, connection=None, device_name=None, virtual_name=None,
ebs=None, no_device=None):
@@ -100,7 +104,7 @@ class LaunchConfiguration(object):
instance_monitoring=False, spot_price=None,
instance_profile_name=None, ebs_optimized=False,
associate_public_ip_address=None, volume_type=None,
- delete_on_termination=True, iops=None):
+ delete_on_termination=True, iops=None, use_block_device_types=False):
"""
A launch configuration.
@@ -152,6 +156,7 @@ class LaunchConfiguration(object):
:param ebs_optimized: Specifies whether the instance is optimized
for EBS I/O (true) or not (false).
+
:type associate_public_ip_address: bool
:param associate_public_ip_address: Used for Auto Scaling groups that launch instances into an Amazon Virtual Private Cloud.
Specifies whether to assign a public IP address to each instance launched in a Amazon VPC.
@@ -178,6 +183,7 @@ class LaunchConfiguration(object):
self.volume_type = volume_type
self.delete_on_termination = delete_on_termination
self.iops = iops
+ self.use_block_device_types = connection.use_block_device_types
def __repr__(self):
return 'LaunchConfiguration:%s' % self.name
@@ -186,8 +192,10 @@ class LaunchConfiguration(object):
if name == 'SecurityGroups':
return self.security_groups
elif name == 'BlockDeviceMappings':
- self.block_device_mappings = ResultSet([('member',
- BlockDeviceMapping)])
+ if self.use_block_device_types:
+ self.block_device_mappings = BDM()
+ else:
+ self.block_device_mappings = ResultSet([('member', BlockDeviceMapping)])
return self.block_device_mappings
elif name == 'InstanceMonitoring':
self.instance_monitoring = InstanceMonitoring(self)