machine,rm: Ignore ENOENT while cleaning machine

Certain paths like `../containers/podman/machine/my-test/podman.sock`
do not exist when machine is not started, so removing a machine before
starting it will result in ENOENT which we should ignore cause these
paths do not exists

Closes: https://github.com/containers/podman/issues/13834

[NO TESTS NEEDED]
[NO NEW TESTS NEEDED]

Signed-off-by: Aditya R <arajan@redhat.com>
This commit is contained in:
Aditya R 2022-04-12 15:33:27 +05:30
parent 0ebd2882f4
commit 8fb9dbdb4e
No known key found for this signature in database
GPG Key ID: 8E5A8A19DF7C8673
1 changed files with 3 additions and 0 deletions

View File

@ -859,6 +859,9 @@ func (v *MachineVM) Remove(_ string, opts machine.RemoveOptions) (string, func()
return confirmationMessage, func() error {
for _, f := range files {
if err := os.Remove(f); err != nil {
if errors.Is(err, os.ErrNotExist) {
continue
}
logrus.Error(err)
}
}