Skip to content

Commit

Permalink
[Hardening] Make the migration '0074_drop_curated_thumbs' more robust
Browse files Browse the repository at this point in the history
(cherry picked from commit 79123f7)
  • Loading branch information
afabiani committed Oct 25, 2022
1 parent a5c1b54 commit 704b9af
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions geonode/base/migrations/0074_drop_curated_thumbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from geonode.base.models import ResourceBase
from geonode.storage.manager import storage_manager
from geonode.thumbs.thumbnails import _generate_thumbnail_name
import logging
logger = logging.getLogger(__name__)


def update_thumbnail_urls_and_delete_curated_thumbs_folder(apps, schema_editor):
Expand All @@ -23,8 +25,11 @@ def update_thumbnail_urls_and_delete_curated_thumbs_folder(apps, schema_editor):
bytes_file = None

if resource and bytes_file:
filename = _generate_thumbnail_name(resource.get_real_instance())
resource.save_thumbnail(filename, bytes_file)
try:
filename = _generate_thumbnail_name(resource.get_real_instance())
resource.save_thumbnail(filename, bytes_file)
except Exception as e:
logger.error(f'Error during updating resource: {e.args[0]}')


class Migration(migrations.Migration):
Expand Down

0 comments on commit 704b9af

Please sign in to comment.