mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
ec2_tag: Fix removing tags without specifying a value (#47228)
This commit is contained in:
@@ -38,17 +38,47 @@
|
||||
tags:
|
||||
foo: foo
|
||||
bar: baz
|
||||
baz: also baz
|
||||
<<: *aws_connection_info
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.tags | length == 3
|
||||
- result.added_tags | length == 2
|
||||
- result.tags | length == 4
|
||||
- result.added_tags | length == 3
|
||||
- result.tags.Name == '{{ resource_prefix }} ec2_tag volume'
|
||||
- result.tags.foo == 'foo'
|
||||
- result.tags.bar == 'baz'
|
||||
- result.tags.baz == 'also baz'
|
||||
|
||||
- name: Remove a tag by name
|
||||
ec2_tag:
|
||||
resource: "{{ volume.volume_id }}"
|
||||
state: absent
|
||||
tags:
|
||||
baz:
|
||||
<<: *aws_connection_info
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.removed_tags | length == 1
|
||||
- "'baz' in result.removed_tags"
|
||||
|
||||
- name: Don't remove a tag
|
||||
ec2_tag:
|
||||
resource: "{{ volume.volume_id }}"
|
||||
state: absent
|
||||
tags:
|
||||
foo: baz
|
||||
<<: *aws_connection_info
|
||||
register: result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
- name: Remove a tag
|
||||
ec2_tag:
|
||||
|
||||
Reference in New Issue
Block a user