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_tag - remove deprecated 'state=list' #829

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
3 changes: 3 additions & 0 deletions changelogs/fragments/66840-ec2_tag-remove-list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
removed_features:
- ec2_tag - the previously deprecated state ``list`` has been removed. To list tags on an EC2 resource the ``ec2_tag_info`` module can be used
(https://github.com/ansible-collections/amazon.aws/pull/829).
16 changes: 6 additions & 10 deletions plugins/modules/ec2_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
state:
description:
- Whether the tags should be present or absent on the resource.
- The use of I(state=list) to interrogate the tags of an instance 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_tag_info).
- The use of I(state=list) to interrogate the tags of an instance was
deprecated in release 1.0.0 and is no longer available in release 4.0.0.
The 'list' functionality has been moved to a dedicated module
M(amazon.aws.ec2_tag_info).
default: present
choices: ['present', 'absent', 'list']
choices: ['present', 'absent']
type: str
tags:
description:
Expand Down Expand Up @@ -125,7 +126,7 @@ def main():
resource=dict(required=True),
tags=dict(type='dict'),
purge_tags=dict(type='bool', default=False),
state=dict(default='present', choices=['present', 'absent', 'list']),
state=dict(default='present', choices=['present', 'absent']),
)
required_if = [('state', 'present', ['tags']), ('state', 'absent', ['tags'])]

Expand All @@ -142,11 +143,6 @@ def main():

current_tags = describe_ec2_tags(ec2, module, resource)

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

if state == 'absent':
removed_tags = {}
for key in tags:
Expand Down
7 changes: 0 additions & 7 deletions tests/integration/targets/ec2_tag/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,13 @@
zone: "{{ aws_region }}a"
register: volume

- name: List the tags on the volume (ec2_tag)
ec2_tag:
resource: "{{ volume.volume_id }}"
state: list
register: result
- name: List the tags on the volume (ec2_tag_info)
ec2_tag_info:
resource: "{{ volume.volume_id }}"
register: result_info

- assert:
that:
- result.tags | length == 1
- result.tags.Name == '{{ resource_prefix }} ec2_tag volume'
- result_info.tags | length == 1
- result_info.tags.Name == '{{ resource_prefix }} ec2_tag volume'

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 +0,0 @@
plugins/modules/ec2_tag.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 +0,0 @@
plugins/modules/ec2_tag.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 +0,0 @@
plugins/modules/ec2_tag.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 +0,0 @@
plugins/modules/ec2_tag.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 +0,0 @@
plugins/modules/ec2_tag.py validate-modules:parameter-state-invalid-choice # Deprecated choice that can't be removed until 2022
5 changes: 2 additions & 3 deletions tests/sanity/ignore-2.9.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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_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_endpoint.py pylint:ansible-deprecated-no-version
plugins/modules/ec2_vpc_endpoint_info.py pylint:ansible-deprecated-no-version
plugins/modules/ec2_vpc_endpoint.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability
plugins/modules/ec2_vpc_endpoint_info.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability
plugins/modules/ec2_instance.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability