Closed Raimis235 closed 5 months ago
One of your custom scripts is using a class (normally used only in plugins) that was removed in NetBox 4.0. The official docs section on plugin migration for 4.0 should give you everything you need to adapt your script.
Since this is a local issue rather than a bug in NetBox itself, I’m converting this issue to a discussion.
Deployment Type
Self-hosted
NetBox Version
v.4.0.0
Python Version
3.10
Steps to Reproduce
Trying to upgrade from 3.7 to 4.0
Expected Behavior
Upgrade from 3.7.x to 4.x expected without big issues.
Observed Behavior
Trying to upgrade netbox, but getting py errors, any sugestions, please?
Applying database migrations (python3 netbox/manage.py migrate)... Operations to perform: Apply all migrations: account, auth, circuits, contenttypes, core, dcim, django_rq, extras, ipam, netbox_dns, sessions, social_django, taggit, tenancy, users, virtualization, vpn, wireless Running migrations: Applying dcim.0186_location_facility... OK Applying dcim.0187_alter_device_vc_position... OK Applying extras.0108_convert_reports_to_scripts... OK Applying extras.0109_script_model...Traceback (most recent call last): File "/opt/netbox-4.0.0/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, cmd_options)
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, *options)
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/core/management/base.py", line 107, in wrapper
res = handle_func(args, kwargs)
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 135, in migrate
state = self._migrate_all_forwards(
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/db/migrations/migration.py", line 132, in apply
operation.database_forwards(
File "/opt/netbox-4.0.0/venv/lib/python3.10/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
self.code(from_state.apps, schema_editor)
File "/opt/netbox-4.0.0/netbox/extras/migrations/0109_script_model.py", line 93, in update_scripts
for script_name in get_module_scripts(module):
File "/opt/netbox-4.0.0/netbox/extras/migrations/0109_script_model.py", line 63, in get_module_scripts
module = loader.load_module()
File "", line 548, in _check_name_wrapper
File "", line 1063, in load_module
File "", line 888, in load_module
File "", line 290, in _load_module_shim
File "", line 719, in _load
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/opt/netbox-4.0.0/netbox/scripts/multi_connect.py", line 13, in
from utilities.choices import ColorChoices
ImportError: cannot import name 'ColorChoices' from 'utilities.choices' (/opt/netbox-4.0.0/netbox/utilities/choices.py)