1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ec2: deprecate device_type option (#55692)

Fixes #55306
This commit is contained in:
Martin Krizek 2019-04-24 12:42:55 +02:00 committed by Sloane Hertel
parent cce05c1ed2
commit 27b64d6524
2 changed files with 6 additions and 14 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- ec2 - Remove deprecated ``device_type`` option (https://github.com/ansible/ansible/issues/55306)

View file

@ -205,9 +205,9 @@ options:
version_added: "1.5"
description:
- a list of hash/dictionaries of volumes to add to the new instance; '[{"key":"value", "key":"value"}]'; keys allowed
are - device_name (str; required), delete_on_termination (bool; False), device_type (deprecated), ephemeral (str),
encrypted (bool; False), snapshot (str), volume_type (str), volume_size (int, GiB), iops (int) - device_type
is deprecated use volume_type, iops must be set when volume_type='io1', ephemeral and snapshot are mutually exclusive.
are - device_name (str; required), delete_on_termination (bool; False), ephemeral (str),
encrypted (bool; False), snapshot (str), volume_type (str), volume_size (int, GiB), iops (int) - iops must be set when
volume_type='io1', ephemeral and snapshot are mutually exclusive.
type: list
ebs_optimized:
version_added: "1.6"
@ -787,17 +787,7 @@ def create_block_device(module, ec2, volume):
# http://aws.amazon.com/about-aws/whats-new/2013/10/09/ebs-provisioned-iops-maximum-iops-gb-ratio-increased-to-30-1/
MAX_IOPS_TO_SIZE_RATIO = 30
# device_type has been used historically to represent volume_type,
# however ec2_vol uses volume_type, as does the BlockDeviceType, so
# we add handling for either/or but not both
if all(key in volume for key in ['device_type', 'volume_type']):
module.fail_json(msg='device_type is a deprecated name for volume_type. Do not use both device_type and volume_type')
if 'device_type' in volume:
module.deprecate('device_type is deprecated for block devices - use volume_type instead',
version=2.9)
# get whichever one is set, or NoneType if neither are set
volume_type = volume.get('device_type') or volume.get('volume_type')
volume_type = volume.get('volume_type')
if 'snapshot' not in volume and 'ephemeral' not in volume:
if 'volume_size' not in volume: