-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for NetBox objects in the custom fields #436
Comments
You don't waste any time, do you? 🙂 |
You know, app development ship takes sometimes a long time to turn, so it's good to start teasing potential developers as soon as possible 😁 And, I may find myself at some point needing that feature 😂 |
Let's test how these NetBox objects look like in the raw data. I have (in NetBox 3.2.0-dev) defined two custom fields,
The obvious question from I can currently figure out three ways to know it:
Of course, there is always an option to not do anything in Performance reminder: If the full object data is to be parsed (again for example to get the tags for the object) it would require an extra NetBox API call for each parent object, so I'm positive that not everyone would like that to happen automatically. |
Personally I'm leaning towards not doing anything in I will leave this open for now if some new insight comes up, but @zachmoody feel free to close this if desired. |
Personally, I'd like to see custom objects turned into |
A thought that I just had... If NetBox was to return a list of the fields that were custom objects or JSON fields with every API call that would save a round-trip.
|
I think opt 3 seems reasonable. Can you think of a reason why it wouldn't be a good idea to just build the check into the Record initializer itself? |
I don't think that's an option because pynetbox cannot currently update objects that contain JSON or object custom fields. |
For the reference here, #457 tracks the JSON save issue. |
I was unable to figure out how to remove the object from a custom field. It is possible to set it once. Trying to assign None, received a traceback. Then figured out that any update of the record is problematic. Let's hope the support can be added soon. There is also custom_field type of multiobject that can bring additional challenges. Ideally it would be turned into a RecordSet. Attached a sample script I was planning to add as reproduction into a new issue, but it would be a duplicate of this one. |
To manage objects in custom field I use a logic to compare
However I figure out an issue of using netbox object in custom field: after set, it's not possible to update other custom field of main object. This is due to the netbox api return a dict of the related object but accept only the id on update. |
This bug from pynetbox 7.0.1(PR #518). Normal JSON data is destructed. Function flatten_custom is wrong modifying. |
NetBox 3.2 will support objects in custom fields: netbox-community/netbox#7006
Some changes are most probably needed in
pynetbox
to support that.The text was updated successfully, but these errors were encountered: