ecs_tag: remove state=list (#66811)
* ecs_tag: remove state=list * adjust tests
This commit is contained in:
parent
3c3cf50e7a
commit
4752547d35
2 changed files with 3 additions and 44 deletions
|
@ -15,7 +15,7 @@ short_description: create and remove tags on Amazon ECS resources
|
|||
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:
|
||||
|
@ -41,9 +41,8 @@ options:
|
|||
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:
|
||||
|
@ -71,13 +70,6 @@ EXAMPLES = r'''
|
|||
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
|
||||
|
@ -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'])]
|
||||
|
@ -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 = {}
|
||||
|
|
|
@ -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}}"
|
||||
|
@ -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}}"
|
||||
|
|
Loading…
Reference in a new issue