Skip to content

Commit

Permalink
Merge pull request #695 from mandar242/issues-694-s3_sync-integration…
Browse files Browse the repository at this point in the history
…-test

s3_sync: Integration test fix: empty buckets before deleting

SUMMARY

Added tasks to empty buckets before deleting them.
S3 requires a bucket to be empty before it can be deleted.
The integration tests in the s3_sync try to delete the buckets without emptying them.
Fixes #694.

ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

tests/integration/targets/s3_sync

Reviewed-by: Markus Bergholz <git@osuv.de>
Reviewed-by: Jill R <None>
Reviewed-by: None <None>
  • Loading branch information
ansible-zuul[bot] authored Aug 24, 2021
2 parents 5067d0a + 32a12ba commit a7c1ac3
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/integration/targets/s3_sync/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,60 @@
- output is changed

always:

- name: Empty all buckets before deleting
block:
- name: list test_bucket objects
aws_s3:
bucket: "{{ test_bucket }}"
mode: list
register: objects
ignore_errors: true

- name: remove objects from test_bucket
aws_s3:
bucket: "{{ test_bucket }}"
mode: delobj
object: "{{ obj }}"
with_items: "{{ objects.s3_keys }}"
loop_control:
loop_var: obj
ignore_errors: true

- name: list test_bucket_2 objects
aws_s3:
bucket: "{{ test_bucket_2 }}"
mode: list
register: objects
ignore_errors: true

- name: remove objects from test_bucket_2
aws_s3:
bucket: "{{ test_bucket_2 }}"
mode: delobj
object: "{{ obj }}"
with_items: "{{ objects.s3_keys }}"
loop_control:
loop_var: obj
ignore_errors: true

- name: list test_bucket_3 objects
aws_s3:
bucket: "{{ test_bucket_3 }}"
mode: list
register: objects
ignore_errors: true

- name: remove objects from test_bucket_3
aws_s3:
bucket: "{{ test_bucket_3 }}"
mode: delobj
object: "{{ obj }}"
with_items: "{{ objects.s3_keys }}"
loop_control:
loop_var: obj
ignore_errors: true

- name: Ensure all buckets are deleted
s3_bucket:
name: "{{item}}"
Expand Down

0 comments on commit a7c1ac3

Please sign in to comment.