Handle InternalServerError exception on files_make_public_t

This commit is contained in:
2016-02-26 19:13:24 +01:00
parent 45d6318252
commit b093f9fd7c

View File

@@ -557,6 +557,7 @@ def files_make_public_t():
"""Loop through all files and if they are images on GCS, make the size t
public
"""
from gcloud.exceptions import InternalServerError
from application.utils.gcs import GoogleCloudStorageBucket
files_collection = app.data.driver.db['files']
for f in files_collection.find({'backend': 'gcs'}):
@@ -567,7 +568,11 @@ def files_make_public_t():
storage = GoogleCloudStorageBucket(str(f['project']))
blob = storage.Get(variation_t['file_path'], to_dict=False)
if blob:
try:
print("Making blob public: {0}".format(blob.path))
blob.make_public()
except InternalServerError:
pass
if __name__ == '__main__':