aboutsummaryrefslogtreecommitdiff
path: root/libpod/reset.go
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2020-08-27 18:05:22 +0200
committerPaul Holzinger <paul.holzinger@web.de>2020-08-28 15:22:03 +0200
commitb84ddc2535d05d2fb2422ca5f6bc2abac2dd36da (patch)
treea3f2081eebfad8ab35a6ba0729edbfc0fd8cb180 /libpod/reset.go
parentcf6d9fe4e66895791418793341c67030fd12c455 (diff)
downloadpodman-b84ddc2535d05d2fb2422ca5f6bc2abac2dd36da.tar.gz
podman-b84ddc2535d05d2fb2422ca5f6bc2abac2dd36da.tar.bz2
podman-b84ddc2535d05d2fb2422ca5f6bc2abac2dd36da.zip
Don't remove config files with podman system reset
Check if storage.conf exists and display a message that this file should be removed if it has not been modified. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'libpod/reset.go')
-rw-r--r--libpod/reset.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/libpod/reset.go b/libpod/reset.go
index cae4d3a04..f8828fed4 100644
--- a/libpod/reset.go
+++ b/libpod/reset.go
@@ -2,12 +2,14 @@ package libpod
import (
"context"
+ "fmt"
"os"
"path/filepath"
"github.com/containers/podman/v2/libpod/define"
"github.com/containers/podman/v2/pkg/rootless"
"github.com/containers/podman/v2/pkg/util"
+ "github.com/containers/storage"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -103,14 +105,16 @@ func (r *Runtime) Reset(ctx context.Context) error {
prevError = err
}
- if rootless.IsRootless() {
- configPath := filepath.Join(os.Getenv("HOME"), ".config/containers")
- if err := os.RemoveAll(configPath); err != nil {
- if prevError != nil {
- logrus.Error(prevError)
- }
- prevError = err
+ if storageConfPath, err := storage.DefaultConfigFile(rootless.IsRootless()); err == nil {
+ if _, err = os.Stat(storageConfPath); err == nil {
+ fmt.Printf("A storage.conf file exists at %s\n", storageConfPath)
+ fmt.Println("You should remove this file if you did not modified the configuration.")
}
+ } else {
+ if prevError != nil {
+ logrus.Error(prevError)
+ }
+ prevError = err
}
return prevError