Fix the backfill script to handle images without any json data at all.
This commit is contained in:
parent
48ed255a55
commit
6070c251ae
1 changed files with 7 additions and 3 deletions
|
@ -34,9 +34,13 @@ def backfill_sizes():
|
|||
uuid = image_storage.uuid
|
||||
with_locations = model.get_storage_by_uuid(uuid)
|
||||
|
||||
json_string = store.get_content(with_locations.locations, store.image_json_path(uuid))
|
||||
json_data = json.loads(json_string)
|
||||
size = json_data.get('Size', json_data.get('size', -1))
|
||||
try:
|
||||
json_string = store.get_content(with_locations.locations, store.image_json_path(uuid))
|
||||
json_data = json.loads(json_string)
|
||||
size = json_data.get('Size', json_data.get('size', -1))
|
||||
except IOError:
|
||||
logger.debug('Image storage with no json %s', uuid)
|
||||
size = -1
|
||||
|
||||
if size == -1:
|
||||
missing += 1
|
||||
|
|
Reference in a new issue