Hi,
I found out that when updating a permission object (not a problem when creating the identical object for the first time) containing constraints with a specific JSON string (a list of objects), pynautobot would fail with an exception Exception has occurred: AttributeError object has no attribute "id"
I tried to analyze the issue and it seems that the error is generated within _diff() -> serialize() method because it would treat JSON string as a Recordobject and expecting id attribute within (which of course cannot be present).
Steps to Reproduce
Let's have a permission object within nautobot
Try to update such an object via pynautobot while having constraints attr containing a "list", e.g. [{"_custom_field_data__owner": "constraint-string-value"}] (valid JSON array of object(s))
Update via pyanutobot fails.
Expected Behavior
Just save the object including constraints.
If you send the same data via a cURL query, it passes and saves without an issue. Example:
I am enclosing a PR (https://github.com/nautobot/pynautobot/pull/28) that solves this issue hopefully at the right spot, but of course I don't see into all the depths of nautobot and other relations between models and stuff :-)
Environment
Hi, I found out that when updating a permission object (not a problem when creating the identical object for the first time) containing constraints with a specific JSON string (a list of objects), pynautobot would fail with an exception
Exception has occurred: AttributeError object has no attribute "id"
I tried to analyze the issue and it seems that the error is generated within
_diff()
->serialize()
method because it would treat JSON string as aRecord
object and expectingid
attribute within (which of course cannot be present).Steps to Reproduce
[{"_custom_field_data__owner": "constraint-string-value"}]
(valid JSON array of object(s))Expected Behavior
Just save the object including constraints.
If you send the same data via a cURL query, it passes and saves without an issue. Example:
I am enclosing a PR (https://github.com/nautobot/pynautobot/pull/28) that solves this issue hopefully at the right spot, but of course I don't see into all the depths of nautobot and other relations between models and stuff :-)