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

Deleting attachments #22

Open
Kani999 opened this issue Jan 6, 2023 · 6 comments · May be fixed by #70
Open

Deleting attachments #22

Kani999 opened this issue Jan 6, 2023 · 6 comments · May be fixed by #70

Comments

@Kani999
Copy link
Owner

Kani999 commented Jan 6, 2023

Idea - netbox-community/netbox#11336

@Kani999
Copy link
Owner Author

Kani999 commented Jan 6, 2023

@Kani999
Copy link
Owner Author

Kani999 commented May 31, 2023

Solution:

@llamafilm
Copy link

I've just installed the plugin today and I'm learning how it works. Maybe it would be useful to have a config option to delete files automatically?
This is also relevant when updating an attachment with a new filename, the old one is retained.

@mjf
Copy link

mjf commented Aug 26, 2024

Garbage collection of completely orphaned files would be very nice but should be also somehow limited. Unless unlinked from an object and confirmed as obsoleted intentionally the attachments should not be garbage collected. Also when overwritten then the original version should be kept in history unless completely unlinked from an object and claimed as unneeded somehow explicitely. ... Just consider some users overwritting important attachments by mistake etc. which is a scenario one would generally like to recover from.

Therefor I see an attachment as something that could have unique identity and only it's content and metadata could change through it's lifetime (e.g., hand crafted network schema for the customer etc.)

@Kani999
Copy link
Owner Author

Kani999 commented Aug 28, 2024

Hello,

can anybody test the version 5.1.4-b1 ?
It adds command remove_orphaned_netbox_attachments to manage.py

It should scan the netbox_attachmments folder and delete all files which are not assigned to any object.
There is also an --dry-run option to just run the command without deleting the objects.
Also use the -v2 option to print out the file names which will be deleted.
Any other options you can find by python /opt/netbox/netbox/manage.py remove_orphaned_netbox_attachments --help

@Kani999
Copy link
Owner Author

Kani999 commented Aug 28, 2024

I've tested it against my netbox-docker installation and it seems that it works correctly.

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

Successfully merging a pull request may close this issue.

3 participants