upgrade from v2.9.11 to v.2.10.6 - custom_field_data issue #4692

Closed
opened 2025-12-29 19:19:33 +01:00 by adam · 0 comments
Owner

Originally created by @saman-com on GitHub (Mar 24, 2021).

NetBox version

v2.9.11

Python version

3.8

Steps to Reproduce

sudo ./upgrade.sh

Expected Behavior

Applying database migrations (python3 netbox/manage.py migrate)...
Operations to perform:
Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, taggit, tenancy, users, virtualization
Running migrations:
Applying extras.0051_migrate_customfields...Traceback (most recent call last):
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1863, in add_fields
join_info = self.setup_joins(name.split(LOOKUP_SEP), opts, alias, allow_many=allow_m2m)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1565, in setup_joins
path, final_field, targets, rest = self.names_to_path(
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1481, in names_to_path
raise FieldError("Cannot resolve keyword '%s' into field. "
django.core.exceptions.FieldError: Cannot resolve keyword 'custom_field_data' into field. Choices are: _cable_peer_id, _cable_peer_type, _cable_peer_type_id, _name, _path, _path_id, cable, cable_id, description, device, device_id, enabled, id, label, lag, lag_id, mac_address, member_interfaces, mgmt_only, mode, mtu, name, tagged_vlans, tags, type, untagged_vlan, untagged_vlan_id

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/init.py", line 401, in execute_from_command_line
utility.execute()
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/init.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 243, in handle
post_migrate_state = executor.migrate(
File "/opt/netbox-2.10.6/venv/lib/python3.8/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 "/opt/netbox-2.10.6/venv/lib/python3.8/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 "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
state = migration.apply(state, schema_editor)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/migrations/migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/migrations/operations/special.py", line 190, in database_forwards
self.code(from_state.apps, schema_editor)
File "/opt/netbox-2.10.6/netbox/extras/migrations/0051_migrate_customfields.py", line 67, in migrate_customfieldvalues
cf_data = model.objects.filter(pk=cfv.obj_id).values('custom_field_data').first()
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/query.py", line 841, in values
clone = self._values(*fields, **expressions)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/query.py", line 836, in _values
clone.query.set_values(fields)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 2174, in set_values
self.add_fields(field_names, True)
File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1885, in add_fields
raise FieldError("Cannot resolve keyword %r into field. "
django.core.exceptions.FieldError: Cannot resolve keyword 'custom_field_data' into field. Choices are: _cable_peer_id, _cable_peer_type, _cable_peer_type_id, _name, _path, _path_id, cable, cable_id, description, device, device_id, enabled, id, label, lag, lag_id, mac_address, member_interfaces, mgmt_only, mode, mtu, name, tagged_vlans, tags, type, untagged_vlan, untagged_vlan_id

Observed Behavior

raise FieldError("Cannot resolve keyword '%s' into field. "

and
raise FieldError("Cannot resolve keyword %r into field. "

Originally created by @saman-com on GitHub (Mar 24, 2021). ### NetBox version v2.9.11 ### Python version 3.8 ### Steps to Reproduce sudo ./upgrade.sh ### Expected Behavior Applying database migrations (python3 netbox/manage.py migrate)... Operations to perform: Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, taggit, tenancy, users, virtualization Running migrations: Applying extras.0051_migrate_customfields...Traceback (most recent call last): File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1863, in add_fields join_info = self.setup_joins(name.split(LOOKUP_SEP), opts, alias, allow_many=allow_m2m) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1565, in setup_joins path, final_field, targets, rest = self.names_to_path( File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1481, in names_to_path raise FieldError("Cannot resolve keyword '%s' into field. " django.core.exceptions.FieldError: Cannot resolve keyword 'custom_field_data' into field. Choices are: _cable_peer_id, _cable_peer_type, _cable_peer_type_id, _name, _path, _path_id, cable, cable_id, description, device, device_id, enabled, id, label, lag, lag_id, mac_address, member_interfaces, mgmt_only, mode, mtu, name, tagged_vlans, tags, type, untagged_vlan, untagged_vlan_id During handling of the above exception, another exception occurred: Traceback (most recent call last): File "netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute output = self.handle(*args, **options) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/base.py", line 85, in wrapped res = handle_func(*args, **kwargs) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 243, in handle post_migrate_state = executor.migrate( File "/opt/netbox-2.10.6/venv/lib/python3.8/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 "/opt/netbox-2.10.6/venv/lib/python3.8/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 "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/migrations/executor.py", line 227, in apply_migration state = migration.apply(state, schema_editor) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/migrations/migration.py", line 124, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/migrations/operations/special.py", line 190, in database_forwards self.code(from_state.apps, schema_editor) File "/opt/netbox-2.10.6/netbox/extras/migrations/0051_migrate_customfields.py", line 67, in migrate_customfieldvalues cf_data = model.objects.filter(pk=cfv.obj_id).values('custom_field_data').first() File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/query.py", line 841, in values clone = self._values(*fields, **expressions) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/query.py", line 836, in _values clone.query.set_values(fields) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 2174, in set_values self.add_fields(field_names, True) File "/opt/netbox-2.10.6/venv/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1885, in add_fields raise FieldError("Cannot resolve keyword %r into field. " django.core.exceptions.FieldError: Cannot resolve keyword 'custom_field_data' into field. Choices are: _cable_peer_id, _cable_peer_type, _cable_peer_type_id, _name, _path, _path_id, cable, cable_id, description, device, device_id, enabled, id, label, lag, lag_id, mac_address, member_interfaces, mgmt_only, mode, mtu, name, tagged_vlans, tags, type, untagged_vlan, untagged_vlan_id ### Observed Behavior raise FieldError("Cannot resolve keyword '%s' into field. " and raise FieldError("Cannot resolve keyword %r into field. "
adam added the type: bug label 2025-12-29 19:19:33 +01:00
adam closed this issue 2025-12-29 19:19:33 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4692