* correctly check that the no_device attribute is specified
 * ignore volume_size requirement if no_device is specified
pull/37099/merge
TJ Tang 7 years ago committed by Brian Coca
parent 99ce712259
commit 11f9286ab6

@ -172,6 +172,17 @@ EXAMPLES = '''
iops: 3000 iops: 3000
delete_on_termination: true delete_on_termination: true
# create a launch configuration to omit the /dev/sdf EBS device that is included in the AMI image
- ec2_lc:
name: special
image_id: ami-XXX
key_name: default
security_groups: ['group', 'group2' ]
instance_type: t1.micro
volumes:
- device_name: /dev/sdf
no_device: true
''' '''
RETURN = ''' RETURN = '''
@ -396,7 +407,7 @@ def create_block_device_meta(module, volume):
if 'device_type' in volume: if 'device_type' in volume:
volume['volume_type'] = volume.pop('device_type') volume['volume_type'] = volume.pop('device_type')
if 'snapshot' not in volume and 'ephemeral' not in volume: if 'snapshot' not in volume and 'ephemeral' not in volume and 'no_device' not in volume:
if 'volume_size' not in volume: if 'volume_size' not in volume:
module.fail_json(msg='Size must be specified when creating a new volume or modifying the root volume') module.fail_json(msg='Size must be specified when creating a new volume or modifying the root volume')
if 'snapshot' in volume: if 'snapshot' in volume:
@ -414,7 +425,7 @@ def create_block_device_meta(module, volume):
if 'device_name' in volume: if 'device_name' in volume:
return_object['DeviceName'] = volume.get('device_name') return_object['DeviceName'] = volume.get('device_name')
if 'no_device' is volume: if 'no_device' in volume:
return_object['NoDevice'] = volume.get('no_device') return_object['NoDevice'] = volume.get('no_device')
if any(key in volume for key in ['snapshot', 'volume_size', 'volume_type', 'delete_on_termination', 'ips', 'encrypted']): if any(key in volume for key in ['snapshot', 'volume_size', 'volume_type', 'delete_on_termination', 'ips', 'encrypted']):

Loading…
Cancel
Save