add level 4

This commit is contained in:
Матвей
2026-10-22 11:37:09 +03:00
parent e9ef559c34
commit 9017861707
24 changed files with 571 additions and 31 deletions
+13
View File
@@ -1,5 +1,6 @@
"""Idempotent private bucket bootstrap; executed with separate admin credentials."""
import time
from uuid import uuid4
from botocore.exceptions import BotoCoreError, ClientError
from .storage.s3 import S3Settings, S3Store
@@ -29,6 +30,18 @@ def main():
except ClientError as error:
if error.response["Error"]["Code"] != "NoSuchBucketPolicy":
raise
# The master health endpoint can become available before a volume accepts
# writes after a restart. Verify the actual data path before APIs start.
probe_key = f"_bootstrap/write-probe-{uuid4()}"
for attempt in range(30):
try:
store.client.put_object(Bucket=bucket, Key=probe_key, Body=b"ready")
store.client.delete_object(Bucket=bucket, Key=probe_key)
break
except (BotoCoreError, ClientError):
if attempt == 29:
raise RuntimeError("S3 write path startup timed out") from None
time.sleep(1)
print("PASS: private S3 bucket ready")
finally:
store.client.close()