Browse code

[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>

Sloane Hertel authored on 2019/09/04 22:42:28
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,2 @@
0
+bugfixes:
1
+  - 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):
389 389
             s3.create_bucket(Bucket=bucket, CreateBucketConfiguration=configuration)
390 390
         else:
391 391
             s3.create_bucket(Bucket=bucket)
392
+        if module.params.get('permission') and not module.params.get('ignore_nonexistent_bucket'):
393
+            # Wait for the bucket to exist before setting ACLs
394
+            s3.get_waiter('bucket_exists').wait(Bucket=bucket)
392 395
         for acl in module.params.get('permission'):
393 396
             s3.put_bucket_acl(ACL=acl, Bucket=bucket)
394 397
     except botocore.exceptions.ClientError as e: