Skip to content

Commit

Permalink
added should_set_policy to the config
Browse files Browse the repository at this point in the history
  • Loading branch information
sametd committed Aug 19, 2024
1 parent e49bf7d commit 7295506
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions polytope_server/common/staging/s3_boto3_staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# does it submit to any jurisdiction.
#

import json
import logging
import random
import time
Expand Down Expand Up @@ -67,6 +68,7 @@ def __init__(self, config):
self.use_ssl = config.get("use_ssl", False)
self.max_threads = config.get("max_threads", 10)
self.buffer_size = config.get("buffer_size", 10 * 1024 * 1024)
self.should_set_policy = config.get("should_set_policy", False)

access_key = config.get("access_key", "")
secret_key = config.get("secret_key", "")
Expand Down Expand Up @@ -109,7 +111,8 @@ def __init__(self, config):
except ClientError as e:
logging.error(f"Error creating bucket: {e}")
# Set bucket policy
self.set_bucket_policy()
if self.should_set_policy:
self.set_bucket_policy()
self.storage_metric_collector = S3StorageMetricCollector(
self.host, self.s3_client, self.bucket, self.get_type()
)
Expand Down Expand Up @@ -201,7 +204,7 @@ def set_bucket_policy(self):
},
],
}
# self.s3_client.put_bucket_policy(Bucket=self.bucket, Policy=json.dumps(policy))
self.s3_client.put_bucket_policy(Bucket=self.bucket, Policy=json.dumps(policy))

def read(self, name):
try:
Expand Down

0 comments on commit 7295506

Please sign in to comment.