Fix more inventory bucket access
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful

This commit is contained in:
Madis Mägi 2023-08-22 08:31:43 +03:00
parent c1e6872e8e
commit e7a017e766

View File

@ -285,7 +285,7 @@ def get_scaled_photo(item_id=None, dimension=0, retry=2):
def get_item(key):
try:
bucket = get_bucket()
r = bucket.get_object(Bucket='kspace-inventory', Key=key)
r = bucket.get_object(Bucket=const.BUCKET_NAME, Key=key)
return r['Body'].read()
except:
return None
@ -295,7 +295,7 @@ def make_thumb(item, dimension):
img = scale_image(img, dimension)
bucket = get_bucket()
thumb_name = "thumb_%s_%d" % (item["_id"], dimension)
bucket.put_object(Body=img.as_blob(), Bucket='kspace-inventory', Key=thumb_name)
bucket.put_object(Body=img.as_blob(), Bucket=const.BUCKET_NAME, Key=thumb_name)
db.inventory.update_one({
"_id": ObjectId(item["_id"]),
}, {
@ -326,7 +326,7 @@ def delete_thumbs(item):
bucket = get_bucket()
for _, thumb in item.get("thumbs", {}).items():
if thumb.get("name"):
bucket.delete_object(Bucket='kspace-inventory', Key=thumb["name"])
bucket.delete_object(Bucket=const.BUCKET_NAME, Key=thumb["name"])
db.inventory.update_one({
"_id": ObjectId(item["_id"])
}, {