Fix more inventory bucket access
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
This commit is contained in:
parent
c1e6872e8e
commit
e7a017e766
@ -285,7 +285,7 @@ def get_scaled_photo(item_id=None, dimension=0, retry=2):
|
|||||||
def get_item(key):
|
def get_item(key):
|
||||||
try:
|
try:
|
||||||
bucket = get_bucket()
|
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()
|
return r['Body'].read()
|
||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
@ -295,7 +295,7 @@ def make_thumb(item, dimension):
|
|||||||
img = scale_image(img, dimension)
|
img = scale_image(img, dimension)
|
||||||
bucket = get_bucket()
|
bucket = get_bucket()
|
||||||
thumb_name = "thumb_%s_%d" % (item["_id"], dimension)
|
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({
|
db.inventory.update_one({
|
||||||
"_id": ObjectId(item["_id"]),
|
"_id": ObjectId(item["_id"]),
|
||||||
}, {
|
}, {
|
||||||
@ -326,7 +326,7 @@ def delete_thumbs(item):
|
|||||||
bucket = get_bucket()
|
bucket = get_bucket()
|
||||||
for _, thumb in item.get("thumbs", {}).items():
|
for _, thumb in item.get("thumbs", {}).items():
|
||||||
if thumb.get("name"):
|
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({
|
db.inventory.update_one({
|
||||||
"_id": ObjectId(item["_id"])
|
"_id": ObjectId(item["_id"])
|
||||||
}, {
|
}, {
|
||||||
|
Loading…
Reference in New Issue
Block a user