Skip to content

Commit

Permalink
aws_s3 - wait for the bucket before setting ACLs (ansible#61735)
Browse files Browse the repository at this point in the history
* Wait for the bucket to become available if possible before setting ACLs
  • Loading branch information
s-hertel authored and samdoran committed Sep 4, 2019
1 parent 531e056 commit 91ccb03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- aws_s3 - Try to wait for the bucket to exist before setting the access control list.
3 changes: 3 additions & 0 deletions lib/ansible/modules/cloud/amazon/aws_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 91ccb03

Please sign in to comment.