Skip to content

Commit d4828d3

Browse files
committed
limactl factory-reset: keep "lima-version" and "protected"
Fix issue 2656 Signed-off-by: Akihiro Suda <[email protected]>
1 parent b3e785e commit d4828d3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: cmd/limactl/factory-reset.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@ func factoryResetAction(_ *cobra.Command, args []string) error {
4646
if err != nil {
4747
return err
4848
}
49+
retain := map[string]struct{}{
50+
filenames.LimaVersion: {},
51+
filenames.Protected: {},
52+
filenames.VzIdentifier: {},
53+
}
4954
for _, f := range fi {
5055
path := filepath.Join(inst.Dir, f.Name())
51-
if !strings.HasSuffix(path, ".yaml") && !strings.HasSuffix(path, ".yml") && f.Name() != filenames.VzIdentifier {
56+
if _, ok := retain[f.Name()]; !ok && !strings.HasSuffix(path, ".yaml") && !strings.HasSuffix(path, ".yml") {
5257
logrus.Infof("Removing %q", path)
5358
if err := os.Remove(path); err != nil {
5459
logrus.Error(err)

0 commit comments

Comments
 (0)