ЛР 4 — БВТ2301 — Парамонов — на 5 #2

Closed
gleb_paramonov wants to merge 5 commits from gleb_paramonov/mtusi2026lab4:solution/bvt2301-paramonov into main
Showing only changes of commit f3ecb9aa23 - Show all commits
+15 -5
View File
@@ -24,9 +24,19 @@ except ClientError as exc:
if exc.response['Error']['Code'] not in ('NoSuchBucketPolicy','404'): raise
else:
raise RuntimeError('Unexpected bucket policy; inspect it before starting API')
try:
storage.client.head_object(Bucket=storage.bucket, Key=HEALTH_KEY)
except ClientError as exc:
if exc.response['Error']['Code'] not in ('404','NoSuchKey'): raise
storage.client.put_object(Bucket=storage.bucket, Key=HEALTH_KEY, Body=HEALTH_BYTES)
deadline=time.monotonic()+90
while True:
try:
try:
storage.client.head_object(Bucket=storage.bucket, Key=HEALTH_KEY)
except ClientError as exc:
if exc.response['Error']['Code'] not in ('404','NoSuchKey'): raise
# Fixed, reserved key/content: retry after uncertain PUT is safe.
storage.client.put_object(Bucket=storage.bucket, Key=HEALTH_KEY, Body=HEALTH_BYTES)
storage.ready()
break
except (BotoCoreError,ClientError):
if time.monotonic()>=deadline:
raise RuntimeError('Storage volumes did not become ready within bootstrap deadline') from None
time.sleep(1)
print('Private bucket ready; bootstrap is repeatable')