Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't auto create bucket when not needed. #647

Merged
merged 5 commits into from
Aug 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Don't auto create bucket when not needed.
trent-codecov committed Aug 27, 2024
commit 9b07bb9b70f81fc08a30b17b28e39bdea2910def
8 changes: 6 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -71,10 +71,14 @@ def setup_worker():
storage_client = get_storage_client()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minio_config = get_config("services", "minio")
bucket_name = get_config("services", "minio", "bucket", default="archive")
auto_create_bucket = get_config("services", "minio", "auto_create_bucket", default=False)
region = minio_config.get("region", "us-east-1")
try:
storage_client.create_root_storage(bucket_name, region)
log.info("Initializing bucket %s", bucket_name)
# note that this is a departure from the old default behavior.
# This is intended as the bucket will exist in most cases where IAC or manual setup is used
if auto_create_bucket:
storage_client.create_root_storage(bucket_name, region)
log.info("Initializing bucket %s", bucket_name)
except BucketAlreadyExistsError:
pass