Skip to content

Exception thrown by 0074_drop_curated_thumbs when upgrading from 3.3.x to 4.x #15

@giohappy

Description

@giohappy

Migration 0074_drop_curated_thumbs threw the following exception while upgrading from 3.3.x demo to 4.x.

File "/usr/src/geonode_master/manage.py", line 31, in <module>
  execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
  utility.execute()
File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 413, in execute
  self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 354, in run_from_argv
  self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 398, in execute
  output = self.handle(*args, **options)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 89, in wrapped
  res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 244, in handle
  post_migrate_state = executor.migrate(
File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 117, in migrate
  state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
  state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
  state = migration.apply(state, schema_editor)
File "/usr/local/lib/python3.10/site-packages/django/db/migrations/migration.py", line 126, in apply
  operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/usr/local/lib/python3.10/site-packages/django/db/migrations/operations/special.py", line 190, in database_forwards
  self.code(from_state.apps, schema_editor)
File "/usr/local/lib/python3.10/site-packages/geonode/base/migrations/0074_drop_curated_thumbs.py", line 26, in update_thumbnail_urls_and_delete_curated_thumbs_folder
  filename = _generate_thumbnail_name(resource.get_real_instance())
File "/usr/local/lib/python3.10/site-packages/polymorphic/models.py", line 173, in get_real_instance
  return real_model.objects.db_manager(self._state.db).get(pk=self.pk)
django4geonode_demo | AttributeError: 'NoneType' object has no attribute 'objects'

Testing the retrieval of the "real instance" models manually (shell script)) we get the following:

Real instance 'test map by admin' found for resource_id:78 - map
Real instance 'Adagio - Johann Sebastian Bach.mp3' found for resource_id:70 - document
No real instance found for resource_id:225 - geostory
Real instance 'remote file' found for resource_id:222 - document
Real instance 'new by admin' found for resource_id:228 - map
No real instance found for resource_id:221 - layer
No real instance found for resource_id:334 - layer
Real instance 'racconto.pdf' found for resource_id:338 - document

It looks like it fails retrieving the polymorphic types for geostory and layers.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions