libpod: cleanup default cache on system reset

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2024-05-29 11:09:06 +02:00
parent aa08552bf6
commit 4ece83bdf9

View File

@ -11,6 +11,7 @@ import (
"github.com/containers/common/libimage"
"github.com/containers/common/libnetwork/types"
blobinfocache "github.com/containers/image/v5/pkg/blobinfocache"
"github.com/containers/podman/v5/libpod/define"
"github.com/containers/podman/v5/pkg/errorhandling"
"github.com/containers/podman/v5/pkg/util"
@ -257,6 +258,14 @@ func (r *Runtime) Reset(ctx context.Context) error {
prevError = err
}
}
if err := blobinfocache.CleanupDefaultCache(nil); err != nil {
if prevError != nil {
logrus.Error(prevError)
}
prevError = err
}
if storageConfPath, err := storage.DefaultConfigFile(); err == nil {
switch storageConfPath {
case stypes.SystemConfigFile: