From 27b64d6524c7789047390f194977f0f356b84ba0 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Wed, 24 Apr 2019 12:42:55 +0200 Subject: [PATCH] ec2: deprecate device_type option (#55692) Fixes #55306 --- .../fragments/55306-ec2-deprecations.yaml | 2 ++ lib/ansible/modules/cloud/amazon/ec2.py | 18 ++++-------------- 2 files changed, 6 insertions(+), 14 deletions(-) create mode 100644 changelogs/fragments/55306-ec2-deprecations.yaml diff --git a/changelogs/fragments/55306-ec2-deprecations.yaml b/changelogs/fragments/55306-ec2-deprecations.yaml new file mode 100644 index 0000000000..0b4da0924c --- /dev/null +++ b/changelogs/fragments/55306-ec2-deprecations.yaml @@ -0,0 +1,2 @@ +minor_changes: + - ec2 - Remove deprecated ``device_type`` option (https://github.com/ansible/ansible/issues/55306) diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py index c3b5a77fc3..6e0998d55d 100644 --- a/lib/ansible/modules/cloud/amazon/ec2.py +++ b/lib/ansible/modules/cloud/amazon/ec2.py @@ -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: