-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
NetBox Edition
NetBox Community
NetBox Version
v4.4.9
Python Version
3.12
Steps to Reproduce
This bug was prompted by netboxlabs/netbox-branching#378, wherein attempting to merge an object which has stale data from a deleted custom field yields a ValidationError exception. This prevents a branch from being merged.
Although this manifests as an issue in the branching plugin, it can be argued that the additional validation is unnecessary, as the stale custom field data can be safely ignored without interfering with the object's validation.
Expected Behavior
The presence of stale custom field data should not cause validation to fail.
Observed Behavior
When attempting to validate an object, any custom field data belonging to a custom field which no longer exists will trigger a validation failure:
netbox/netbox/netbox/models/features.py
Lines 291 to 296 in f510e40
| # Validate all field values | |
| for field_name, value in self.custom_field_data.items(): | |
| if field_name not in custom_fields: | |
| raise ValidationError(_("Unknown field name '{name}' in custom field data.").format( | |
| name=field_name | |
| )) |