Skip to content

ObjectChanges moved to core module in netbox 4.1 #700

@Urth

Description

@Urth

pynetbox version

7.5.0

NetBox version

4.2.9

Python version

3.12

Steps to Reproduce

from pynetbox import api
from pynetbox.models.extras import ObjectChanges
nb = api(netbox_url, token=netbox_token)
change = next(nb.core.object_changes.filter(limit=1), None)
assert isinstance(change, ObjectChanges), type(change)

On >netbox-4.1 the ObjectChanges model is not used and this causes the object_data, postchange_data and prechange_data to be processed as Records. As a result simple truthiness checks if change.postchange_data: always yields True because bool(Record({}, None, None)) is True which is unexpected.

Expected Behavior

nb.core.object_changes should return ObjectChanges instances.

Observed Behavior

nb.core.object_changes returns Record instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pynetboxseverity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions