-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Prevent the deletion of interfaces which have children assigned #12135
Comments
I propose that we change dcim/models/device_components.py#L485 to And do the same for other similar cases. |
I like this and I think with a confirmation screen which shows all interfaces to be deleted this would be very handy to have. |
I have to disagree; this seems very dangerous IMO. If the concern is about leaving orphaned interfaces, I'd suggest changing the |
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. |
I'm good with either, but I do think that the delete confirmation, which tells which other objects are about to be deleted would suffice UI wise. Is your concern more about API behavior @jeremystretch ? |
I agree. Changing it to cascade in combination with this wonderful PR would be a much better solution. If I'm understanding it correctly, the suggested solution would require one to go the the interfaces tab and delete all virtual interfaces before deleting an entire device or removing a module. This seems super tedious. Imagine having to remove an entire rack and you have to go to every single device to remove virtual interfaces. Edit: Tested it out and it does indeed function that way. In PR #14091 you can delete a device if it doesn't have any virtual interfaces but not if it has any. Seems inconsitent and confusing. Why are child interfaces more important than parent interfaces when deleting an entire device? |
@kkthxbye-code as I note above, the issue with blindly cascading interface deletions is that it can result in inadvertent deletion of child interfaces, which the user might not even be aware exist. #13690 does not offer sufficient protection against this because it is limited to workflows within the user interface.
That's great feedback. Could you comment on the PR itself please? I'm sure we can work around it to bypass the issue for device/VM deletions. |
* Closes #12135: Prevent the deletion of interfaces with children * Change PROTECT to RESTRICT * Extend handle_protectederror() to also handle RestrictedError * Fix string translation * Update migrations * Support bulk removal of parent interfaces via UI if all children are included * Add support for the bulk deletion of restricted objects via REST API
NetBox version
v3.4.7
Feature type
Change to existing functionality
Proposed functionality
When a parent interface is removed the child interface remains. There was some discussion in #9359 (comment) regarding this but I don't think it was ever implemented or an explicit decision to not add this feature.
Initial state
After deleting the parent interface
The same is true when deleting a module. The parent interface is remove but the child persists.
Use case
I'm sure there are exceptions but I would think the child interfaces should be removed whenever the parent is deleted.
Database changes
I'm not smart enough for this.
External dependencies
No response
The text was updated successfully, but these errors were encountered: