netlab icon indicating copy to clipboard operation
netlab copied to clipboard

Cleanup .vagrant directory when 'netlab down --cleanup' is used

Open jbemmel opened this issue 1 year ago • 2 comments

When using Vagrant boxes, a .vagrant directory is created. Disk images for the vms get removed, but the directory itself remains

If there are concerns around deleting non-Netlab related files, we could consider renaming .vagrant to .netlab.vagrant

jbemmel avatar Dec 09 '24 15:12 jbemmel

Nobody complained in the four years we're using Vagrant, so I guess this is not a high priority (as opposed to all the visible stuff Ansible and containerlab leave behind)

ipspace avatar Dec 09 '24 17:12 ipspace

I'm worried about what might happen if vagrant fails to shut down nodes and then we remove stuff it needs. Containerlab is a different story because you cannot remove its files (they are owned by root).

The only safe way I can see to do this is to remove .vagrant directory only if (A) the lab used libvirt provider and (B) vagrant down succeeded, which makes libvirt provider the "natural" place to do the cleanup.

ipspace avatar Jan 09 '25 08:01 ipspace