Skip to content
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

Updating assigned_object_id does not refresh assigned_object in instance #496

Closed
klausmark opened this issue Sep 6, 2022 · 2 comments
Closed

Comments

@klausmark
Copy link

klausmark commented Sep 6, 2022

Updating assigned_object_id does not refresh assigned_object in instance

>>> type(ip)
<class 'pynetbox.models.ipam.IpAddresses'>
>>> ip.update({"assigned_object_id": 10})
True
>>> ip.assigned_object_id
10
>>> ip.assigned_object.id
5359
@markkuleinio
Copy link
Contributor

If I'm not mistaken, it has always been so that if you update some of the objects properties and save it, pynetbox does not make extra calls to NetBox API automatically to update the full object (there is no other way to know all the field contents).

If you need the object to be fully updated, you need to call ip.full_details() after partially updating the object: that forces execution of extra NetBox API calls (one or more) to populate all the details.

@klausmark
Copy link
Author

Thanks for the explanation, and it makes sense, to make as few API calls as possible. But the update leaves the instance in i wrong state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants