ec2_tag: Fix removing tags without specifying a value (#47228)

This commit is contained in:
flowerysong
2018-10-18 10:13:08 -04:00
committed by Ryan Brown
parent 3f629c426c
commit 0fc639e755
2 changed files with 52 additions and 5 deletions

View File

@@ -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: