Skip to content

Ignore stale custom field data when validating an object #21049

@jeremystretch

Description

@jeremystretch

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:

# 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
))

Metadata

Metadata

Assignees

Labels

netboxstatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions