Skip to content

Commit

Permalink
ecs_tag: remove state=list (ansible#66811)
Browse files Browse the repository at this point in the history
* ecs_tag: remove state=list

* adjust tests
  • Loading branch information
resmo authored Jan 29, 2020
1 parent 3c3cf50 commit 4752547
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 44 deletions.
17 changes: 3 additions & 14 deletions lib/ansible/modules/cloud/amazon/ecs_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
notes:
- none
description:
- Creates, removes and lists tags for Amazon ECS resources.
- Creates and removes tags for Amazon ECS resources.
- Resources are referenced by their cluster name.
version_added: '2.10'
author:
Expand All @@ -41,9 +41,8 @@
state:
description:
- Whether the tags should be present or absent on the resource.
- Use C(list) to interrogate the tags of an ECS resource.
default: present
choices: ['present', 'absent', 'list']
choices: ['present', 'absent']
type: str
tags:
description:
Expand Down Expand Up @@ -71,13 +70,6 @@
Name: ubervol
env: prod
- name: Retrieve all tags on a cluster
ecs_tag:
cluster_name: mycluster
resource: http_task
resource_type: task
state: list
- name: Remove the Env tag
ecs_tag:
cluster_name: mycluster
Expand Down Expand Up @@ -168,7 +160,7 @@ def main():
resource=dict(required=False),
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']),
resource_type=dict(default='cluster', choices=['cluster', 'task', 'service', 'task_definition', 'container'])
)
required_if = [('state', 'present', ['tags']), ('state', 'absent', ['tags'])]
Expand All @@ -193,9 +185,6 @@ def main():

current_tags = get_tags(ecs, module, resource_arn)

if state == 'list':
module.exit_json(changed=False, tags=current_tags)

add_tags, remove = compare_aws_tags(current_tags, tags, purge_tags=purge_tags)

remove_tags = {}
Expand Down
30 changes: 0 additions & 30 deletions test/integration/targets/ecs_tag/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,6 @@

# Test tagging cluster resource

- name: cluster tags - list when there are none
ecs_tag:
cluster_name: "{{ resource_prefix}}"
resource: "{{ resource_prefix}}"
resource_type: cluster
state: list
register: taglist

- name: cluster tags - Should be an empty list
assert:
that:
- taglist.tags|list|length == 0
- taglist.failed == false
- taglist.changed == false

- name: cluster tags - Add tags to cluster
ecs_tag:
cluster_name: "{{resource_prefix}}"
Expand Down Expand Up @@ -209,21 +194,6 @@
- taglist.changed == false
- taglist.tags.Name == "service-{{ resource_prefix }}"

- name: service tags - retrieve all tags on a service
ecs_tag:
cluster_name: "{{resource_prefix}}"
resource: "{{ecs_service_creation.service.serviceName}}"
resource_type: service
state: list
register: taglist

- name: services tags - should have 1 tag
assert:
that:
- taglist.tags|list|length == 1
- taglist.failed == false
- taglist.changed == false

- name: service tags - remove service tags
ecs_tag:
cluster_name: "{{resource_prefix}}"
Expand Down

0 comments on commit 4752547

Please sign in to comment.