netbox
netbox copied to clipboard
Inventory Item editing problem
NetBox version
v3.2.7
Python version
3.10
Steps to Reproduce
- Click "Edit" button on any inventory item which associated with Device A / Interface A
- Change device field to Device B
- Click "Save" button
Expected Behavior
"Component" link should be changed to Device B
Observed Behavior
"Component" link was Device A / Interface A
"Component" link should be changed to Device B
Should it? I agree that there is a bug here as moving an interface item with a link to a component leaves it in an inconsistant state, but how would moving it work? We can't just move the component to the other device. We also can't just find a component with the same name reliably.
One of the following might be a solution:
- Reject when saving with an error indicating that it's not possible to move inventory items that have a link to a component.
- Remove the link when moving an inventory item.
The inventory item -> component link is a little weird to begin with though, as there is no way to "unlink" them without deleting the inventory item afaik. Not sure what the correct solution is here.
The "device" field is simply a filter field, it is not an accurate reflection of the current device. If you change the device and then select the component dropdown it should populate it with components from the new device that you can select, but you must select one of those new componets.
@DanSheps - I'm not sure I follow Dan. Are you saying it should be like that or that it is? Because Device is definitely not just a filter field in this case, it decides the device field of the InventoryItem model. It is also possible to update the device of the InventoryItem through the API, are you saying that this is unintended as well?
it is not an accurate reflection of the current device
I mean it is here, which is what causes the bug as it is neither synchronized with the parent component or validated against it.
You are right, going to blame that on me being a rush to get to dinner. Forgot that it was also a component model.
Anyways, we don't allow changing front port/rear port/interface, that could be part of the bug. However Inventory is a lititle different in that often it is a removeable so perhaps we should allow changes; however there is no way to re-associate it to another component from what I can tell, in the GUI. It is also likely that it is intended to not be moveable based on the behaviour we are seeing.
Based on this I would say, for now we should raise a error that it is not moveable.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.
As of NetBox v3.3.8 it's not possible to change the device to which an inventory item is assigned, so this can no longer be reproduced. Please see #10447 for further discussion relating to this functionality.