[stable-2.8] aws_s3 - wait for the bucket before setting ACLs (#61735)

* Wait for the bucket to become available if possible before setting ACLs
(cherry picked from commit 91ccb03552)

Co-authored-by: Sloane Hertel <shertel@redhat.com>
pull/61847/head
Sloane Hertel 6 years ago committed by Toshio Kuratomi
parent 99f9eab19d
commit e93b8f054e

@ -0,0 +1,2 @@
bugfixes:
- aws_s3 - Try to wait for the bucket to exist before setting the access control list.

@ -389,6 +389,9 @@ def create_bucket(module, s3, bucket, location=None):
s3.create_bucket(Bucket=bucket, CreateBucketConfiguration=configuration)
else:
s3.create_bucket(Bucket=bucket)
if module.params.get('permission') and not module.params.get('ignore_nonexistent_bucket'):
# Wait for the bucket to exist before setting ACLs
s3.get_waiter('bucket_exists').wait(Bucket=bucket)
for acl in module.params.get('permission'):
s3.put_bucket_acl(ACL=acl, Bucket=bucket)
except botocore.exceptions.ClientError as e:

Loading…
Cancel
Save