Issue when upgrading from Netbox 2.7.12 to 2.8.5 #3772

Closed
opened 2025-12-29 18:31:09 +01:00 by adam · 2 comments
Owner

Originally created by @arjenvri on GitHub (Jun 11, 2020).

Environment

  • Python version: 3.6.9
  • NetBox version: 2.7.12

Steps to Reproduce

  1. Replace existing Netbox folder with contents of 2.8.5 pkg
  2. Copy configuration file back
  3. Run ./update.sh

Expected Behavior

Successful upgrade of database

Observed Behavior

root@netbox-ubuntu-1804:/opt/netbox# venv/bin/python3 manage.py migrate
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/init.py", line 401, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/init.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 86, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in init
self.loader = MigrationLoader(self.connection)
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in init
self.build_graph()
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 206, in build_graph
self.load_disk()
File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 108, in load_disk
migration_module = import_module(migration_path)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/opt/netbox/extras/migrations/0001_initial_squashed_0013_objectchange.py", line 36, in
class Migration(migrations.Migration):
File "/opt/netbox/extras/migrations/0001_initial_squashed_0013_objectchange.py", line 127, in Migration
('image', models.ImageField(height_field='image_height', upload_to=extras.models.image_upload, width_field='image_width')),
AttributeError: module 'extras.models' has no attribute 'image_upload'

Originally created by @arjenvri on GitHub (Jun 11, 2020). ### Environment * Python version: 3.6.9 * NetBox version: 2.7.12 ### Steps to Reproduce 1. Replace existing Netbox folder with contents of 2.8.5 pkg 2. Copy configuration file back 3. Run ./update.sh ### Expected Behavior Successful upgrade of database ### Observed Behavior root@netbox-ubuntu-1804:/opt/netbox# venv/bin/python3 manage.py migrate Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute output = self.handle(*args, **options) File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped res = handle_func(*args, **kwargs) File "/opt/netbox/venv/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 86, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__ self.loader = MigrationLoader(self.connection) File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 49, in __init__ self.build_graph() File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 206, in build_graph self.load_disk() File "/opt/netbox/venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 108, in load_disk migration_module = import_module(migration_path) File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/opt/netbox/extras/migrations/0001_initial_squashed_0013_objectchange.py", line 36, in <module> class Migration(migrations.Migration): File "/opt/netbox/extras/migrations/0001_initial_squashed_0013_objectchange.py", line 127, in Migration ('image', models.ImageField(height_field='image_height', upload_to=extras.models.image_upload, width_field='image_width')), AttributeError: module 'extras.models' has no attribute 'image_upload'
adam closed this issue 2025-12-29 18:31:09 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jun 11, 2020):

If you actually do this (replace, not overwrite):

Replace existing Netbox folder with contents of 2.8.5 pkg

Then this won't happen:

File "/opt/netbox/extras/migrations/0001_initial_squashed_0013_objectchange.py", line 127, in Migration
('image', models.ImageField(height_field='image_height', upload_to=extras.models.image_upload, width_field='image_width')),
AttributeError: module 'extras.models' has no attribute 'image_upload'

Because the file extras/migrations/0001_initial_squashed_0013_objectchange.py doesn't exist in the v2.8.5 release. Please post to the mailing list if you need further assistance.

@jeremystretch commented on GitHub (Jun 11, 2020): If you actually do this (replace, not overwrite): > **Replace** existing Netbox folder with contents of 2.8.5 pkg Then this won't happen: > File "/opt/netbox/extras/migrations/0001_initial_squashed_0013_objectchange.py", line 127, in Migration ('image', models.ImageField(height_field='image_height', upload_to=extras.models.image_upload, width_field='image_width')), AttributeError: module 'extras.models' has no attribute 'image_upload' Because the file `extras/migrations/0001_initial_squashed_0013_objectchange.py` doesn't exist in the v2.8.5 release. Please post to the mailing list if you need further assistance.
Author
Owner

@arjenvri commented on GitHub (Jun 11, 2020):

Excellent! Much appreciated!

@arjenvri commented on GitHub (Jun 11, 2020): Excellent! Much appreciated!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3772