runfinch / finch

The Finch CLI is an open source client for container development
https://www.runfinch.com
Apache License 2.0
3.48k stars 88 forks source link

fix: add force to cni cleanup on boot service #785

Closed ollypom closed 5 months ago

ollypom commented 5 months ago

Issue #, if available:

Description of changes: When testing Finch 1.1 I was seeing the new finch-cleanup-on-boot.service service fail.

PS C:\Program Files\Finch> wsl -d lima-finch 
[systemd]
Failed Units: 2
  auditd.service
  finch-cleanup-on-boot.service

Inspecting the service you see:

[root@mymachine Finch]# journalctl -u finch-cleanup-on-boot
Feb 01 10:48:26 mymachine systemd[1]: Starting finch-cleanup-on-boot.service - Delete hanging data on boot...
Feb 01 10:48:26 mymachine sudo[938]:     root : PWD=/ ; USER=root ; COMMAND=/usr/bin/rm /var/lib/cni/networks/bridge/**
Feb 01 10:48:26 mymachine sudo[938]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Feb 01 10:48:26 mymachine bash[939]: rm: cannot remove '/var/lib/cni/networks/bridge/**': No such file or directory
Feb 01 10:48:26 mymachine sudo[938]: pam_unix(sudo:session): session closed for user root
Feb 01 10:48:26 mymachine sudo[937]:     root : PWD=/ ; USER=root ; COMMAND=/usr/bin/rm /var/lib/cni/results/bridge-finch-*
Feb 01 10:48:26 mymachine sudo[937]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Feb 01 10:48:26 mymachine bash[940]: rm: cannot remove '/var/lib/cni/results/bridge-finch-*': No such file or directory
Feb 01 10:48:26 mymachine sudo[937]: pam_unix(sudo:session): session closed for user root
Feb 01 10:48:26 mymachine systemd[1]: finch-cleanup-on-boot.service: Main process exited, code=exited, status=1/FAILURE
Feb 01 10:48:26 mymachine systemd[1]: finch-cleanup-on-boot.service: Failed with result 'exit-code'.
Feb 01 10:48:26 mymachine systemd[1]: Failed to start finch-cleanup-on-boot.service - Delete hanging data on boot.

So I have add the -rf flags to this command so that even if the files do not exist the systemd service will not fail.

Testing done: I have manually tested this change by adding it to my own finch.yaml configuration, then stopping / removing the VM and re-initializing it.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

pendo324 commented 5 months ago

Thanks. One Windows test host is broken right now (will fix) but I think enough tests passed to merge.