crc-org / crc-extension

Red Hat OpenShift Local Extension for integration of OpenShift Local clusters with Podman Desktop
Apache License 2.0
13 stars 16 forks source link

Ability to clean the cache #128

Open themr0c opened 1 year ago

themr0c commented 1 year ago

On Windows 10 Pro, I see that the cache is containing obsolete files:

tree .\.crc\
Folder PATH listing
Volume serial number is 000000FE 3C28:ECE5
C:\USERS\FABRICE\.CRC
├───bin
│   └───oc
├───cache
│   ├───crc_microshift_hyperv_4.12.13_amd64
│   └───crc_microshift_hyperv_4.12.15_amd64
└───machines

I would like to remove the obsolete files aka. clean the cache without using the CLI or the file explorer.

themr0c commented 1 year ago

Additionally, deleting the files from the CLI is difficult:

 rm .\.crc\cache\crc_microshift_hyperv_4.12.13_amd64

Confirm
The item at C:\Users\Fabrice\.crc\cache\crc_microshift_hyperv_4.12.13_amd64 has children and the Recurse parameter was
not specified. If you continue, all children will be removed with the item. Are you sure you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): A
rm : Cannot remove item C:\Users\Fabrice\.crc\cache\crc_microshift_hyperv_4.12.13_amd64\id_ecdsa_crc: You do not have
sufficient access rights to perform this operation.
At line:1 char:1
+ rm .\.crc\cache\crc_microshift_hyperv_4.12.13_amd64
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (id_ecdsa_crc:FileInfo) [Remove-Item], IOException
    + FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
rm : Directory C:\Users\Fabrice\.crc\cache\crc_microshift_hyperv_4.12.13_amd64 cannot be removed because it is not
empty.
At line:1 char:1
+ rm .\.crc\cache\crc_microshift_hyperv_4.12.13_amd64
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\Fabric...v_4.12.13_amd64:DirectoryInfo) [Remove-Item], IOException
    + FullyQualifiedErrorId : DirectoryNotEmpty,Microsoft.PowerShell.Commands.RemoveItemCommand
gbraad commented 1 year ago

We have no real cache cleaning functionality... this is a big miss. The same can also be said about log files... just check crcd.log.

themr0c commented 1 year ago

Indeed, log rotation would also be a good idea.

My log files are not massive yet, but they are growing fast (15 MB for crcd.log, with 31000 lines).