Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2_vol - remove deprecated state=list #828

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/108-ec2_vol-state-list-remove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
removed_features:
- ec2_vol - the previously deprecated state ``list`` has been removed. To list volumes the ``ec2_vol_info`` module can be used (https://github.com/ansible-collections/amazon.aws/pull/828).
29 changes: 5 additions & 24 deletions plugins/modules/ec2_vol.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@
state:
description:
- Whether to ensure the volume is present or absent.
- The use of I(state=list) to interrogate the volume has been deprecated
and will be removed after 2022-06-01. The 'list' functionality
has been moved to a dedicated module M(amazon.aws.ec2_vol_info).
- I(state=list) was deprecated in release 1.1.0 and is no longer available
with release 4.0.0. The 'list' functionality has been moved to a dedicated
module M(amazon.aws.ec2_vol_info).
default: present
choices: ['absent', 'present', 'list']
choices: ['absent', 'present']
type: str
tags:
description:
Expand Down Expand Up @@ -187,12 +187,6 @@
instance: None
region: us-west-2

# List volumes for an instance
- amazon.aws.ec2_vol:
instance: i-XXXXXX
state: list
region: us-west-2

# Create new volume using SSD storage
- amazon.aws.ec2_vol:
instance: XXXXXX
Expand Down Expand Up @@ -720,7 +714,7 @@ def main():
delete_on_termination=dict(default=False, type='bool'),
zone=dict(aliases=['availability_zone', 'aws_zone', 'ec2_zone']),
snapshot=dict(),
state=dict(default='present', choices=['absent', 'present', 'list']),
state=dict(default='present', choices=['absent', 'present']),
tags=dict(default={}, type='dict'),
modify_volume=dict(default=False, type='bool'),
throughput=dict(type='int'),
Expand Down Expand Up @@ -752,10 +746,6 @@ def main():
throughput = module.params.get('throughput')
multi_attach = module.params.get('multi_attach')

if state == 'list':
module.deprecate(
'Using the "list" state has been deprecated. Please use the ec2_vol_info module instead', date='2022-06-01', collection_name='amazon.aws')

# Ensure we have the zone or can get the zone
if instance is None and zone is None and state == 'present':
module.fail_json(msg="You must specify either instance or zone")
Expand Down Expand Up @@ -791,15 +781,6 @@ def main():

ec2_conn = module.client('ec2', AWSRetry.jittered_backoff())

if state == 'list':
returned_volumes = []
vols = get_volumes(module, ec2_conn)

for v in vols:
returned_volumes.append(get_volume_info(module, v))

module.exit_json(changed=False, volumes=returned_volumes)

# Here we need to get the zone info for the instance. This covers situation where
# instance is specified but zone isn't.
# Useful for playbooks chaining instance launch with volume create + attach and where the
Expand Down
13 changes: 0 additions & 13 deletions tests/integration/targets/ec2_vol/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -413,19 +413,6 @@
- attach_new_vol_from_snapshot_result.volume.attachment_set[0].status in ['attached', 'attaching']
- attach_new_vol_from_snapshot_result.volume.attachment_set[0].instance_id == test_instance.instance_ids[0]

- name: list volumes attached to instance
ec2_vol:
instance: "{{ test_instance.instance_ids[0] }}"
state: list
register: inst_vols

- name: check task return attributes
assert:
that:
- not inst_vols.changed
- "'volumes' in inst_vols"
- inst_vols.volumes | length == 4

- name: get info on ebs volumes
ec2_vol_info:
register: ec2_vol_info
Expand Down
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.10.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
plugins/modules/ec2_tag.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
plugins/modules/ec2_vol.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.11.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
plugins/modules/ec2_tag.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
plugins/modules/ec2_vol.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.12.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
plugins/modules/ec2_tag.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
plugins/modules/ec2_vol.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.13.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
plugins/modules/ec2_tag.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
plugins/modules/ec2_vol.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.14.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
plugins/modules/ec2_tag.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
plugins/modules/ec2_vol.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.9.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins/module_utils/botocore.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability
plugins/modules/aws_az_info.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability
plugins/modules/ec2_tag.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability
plugins/modules/ec2_vol.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability
plugins/modules/ec2_vpc_dhcp_option.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability
plugins/modules/ec2_vpc_igw_info.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability
plugins/modules/ec2_vpc_endpoint.py pylint:ansible-deprecated-no-version
Expand Down