Issue during upgrade from 3.2.6 to 3.3.6 #11957
-
NetBox version Python version OS Steps to Reproduce Observed Behavior |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Looks like you have a cable whose endpoint points to a console port that doesn't exist. Unfortunately, these Generic Foreign Keys cannot have their refential integrity enforced by the database itself like regular foreign keys, and so it relies on the Django code to maintain them - which doesn't always do it properly. What that code is doing is effectively:
and then iterating through those rows to create new cable termination objects. But there's at least one row where either the "a" type/id or "b" type/id points to a non-existent endpoint. Unfortunately, the error doesn't tell you specifically which row this happened on. You might be able to temporarily modify that file, insert a You may be able to filter, in the GUI, down to just those cables which have console ports at either end. Or it might be possible to write a hairy SQL join along the lines of these - they were for a different case (assigned_object_type and assigned_object_id) but has some similarities to what you're looking for. You'd have to build the query yourself; I don't have a Netbox 3.2 lying around to test with. You can at least find the content type id for console ports: in my case I get 31 (it may be different for you)
Then identify all cables which connect to console ports:
|
Beta Was this translation helpful? Give feedback.
Code ref: https://github.com/netbox-community/netbox/blob/v3.4.5/netbox/dcim/migrations/0158_populate_cable_terminations.py#L41-L54
Looks like you have a cable whose endpoint points to a console port that doesn't exist. Unfortunately, these Generic Foreign Keys cannot have their refential integrity enforced by the database itself like regular foreign keys, and so it relies on the Django code to maintain them - which doesn't always do it properly.
What that code is doing is effectively:
and then iterating through those rows to create new cable termination objects. But there's at least on…