DCIM/Devices: Modules not added #17861
Replies: 2 comments 1 reply
-
Aside: duplicate of #17842.
That's useful information, because the modules are created by the first save (when the device itself is created). Therefore, what's likely happening is that the second save is resetting the cached module counts to zero. Try reloading the device with refresh_from_db() before setting the primary_ip4 and saving it back.
Or use update() to set only the primary_ip4:
Aside: why use |
Beta Was this translation helpful? Give feedback.
-
I can reproduce your problem in nbshell:
I go to
Notice it's a bit weird to have both "interfaces_count" (which is correct) and "interface_count" (which is wrong). I think
Then if I run in a different window:
Back in the first window:
Now the counts are correct. And the GUI displays the missing tabs. The general solution (to avoid running calculate_cached_counts) is to refresh the device from the db after creating it:
This new device has the correct tabs visible. |
Beta Was this translation helpful? Give feedback.
-
Deployment Type
Self-hosted
Triage priority
I'm a NetBox Labs customer
NetBox Version
v4.1.4
Python Version
3.12
Steps to Reproduce
Within the second save, modules (power outlets, console ports) were not added in the gui.
The Change Log of the device says the modules are generated....
Important:
If i skip the second device.save() the modules were created...
But the ip assignment (settattr) is not added...
My code:
def run (self, data, commit):
Expected Behavior
Make Topic Console Ports, Power Ports visible in Device View
Observed Behavior
These Objects were generated, but arent visible...
Beta Was this translation helpful? Give feedback.
All reactions