aws_s3 - wait for the bucket before setting ACLs (#61735)

* Wait for the bucket to become available if possible before setting ACLs
pull/61784/head
Sloane Hertel 5 years ago committed by Sam Doran
parent 531e0560cb
commit 91ccb03552

@ -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) s3.create_bucket(Bucket=bucket, CreateBucketConfiguration=configuration)
else: else:
s3.create_bucket(Bucket=bucket) 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'): for acl in module.params.get('permission'):
s3.put_bucket_acl(ACL=acl, Bucket=bucket) s3.put_bucket_acl(ACL=acl, Bucket=bucket)
except botocore.exceptions.ClientError as e: except botocore.exceptions.ClientError as e:

Loading…
Cancel
Save