-
Notifications
You must be signed in to change notification settings - Fork 184
Open
Labels
pynetboxseverity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application
Description
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
Labels
pynetboxseverity: lowDoes not significantly disrupt application functionality, or a workaround is availableDoes not significantly disrupt application functionality, or a workaround is availablestatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationThis issue is tentatively accepted pending a volunteer committed to its implementationtype: bugA confirmed report of unexpected behavior in the applicationA confirmed report of unexpected behavior in the application