forked from mtusi2026/mtusi2026lab6
14 lines
575 B
Python
14 lines
575 B
Python
"""Idempotent private bucket bootstrap, executed only with administrative S3 keys."""
|
|
from botocore.exceptions import ClientError
|
|
from objects import Objects
|
|
from postgres import setting
|
|
|
|
objects = Objects(setting)
|
|
try:
|
|
objects.client.create_bucket(Bucket=objects.bucket)
|
|
except ClientError as exc:
|
|
if exc.response['Error']['Code'] not in ('BucketAlreadyOwnedByYou', 'BucketAlreadyExists'):
|
|
raise RuntimeError('Bucket bootstrap failed') from None
|
|
objects.ready()
|
|
print('Private bucket ready; static authenticated identities loaded from local secret config.')
|