Fixed error on dropbox replication

This commit is contained in:
Martin Schett 2021-01-19 18:46:35 +01:00
parent 47335e1aa4
commit 94f7f2182e
2 changed files with 4 additions and 1 deletions

View File

@ -46,7 +46,8 @@ class DropboxService(StorageServiceInterface):
try: try:
dbx = dropbox.Dropbox(settings.DROPBOX_OAUTH2_ACCESS_TOKEN) dbx = dropbox.Dropbox(settings.DROPBOX_OAUTH2_ACCESS_TOKEN)
dbx.files_upload(file, settings.DROPBOX_IMAGE_FOLDER + filename) dbx.files_upload(file, settings.DROPBOX_IMAGE_FOLDER + filename)
except: except Exception as ex:
print(ex)
return False return False
return True return True

View File

@ -138,6 +138,8 @@ class ImageEndpoint:
# at this point we know at least one valid image is available # at this point we know at least one valid image is available
for service in ImageEndpoint.storageServiceList: for service in ImageEndpoint.storageServiceList:
if not recovery_has_image[service.name] or not recovery_hash_matches[service.name]: if not recovery_has_image[service.name] or not recovery_hash_matches[service.name]:
if recovery_has_image[service.name]:
service.delete_file(metadata['filename'])
if not service.create_file(metadata['filename'], valid_image_bytes): if not service.create_file(metadata['filename'], valid_image_bytes):
logger.error('Error duplicating file in service ' + service.name) logger.error('Error duplicating file in service ' + service.name)