DodoApp: Fix app uninstall
Change-Id: I17c28bbd88dde9c064a31388411ebf40cffdea31
diff --git a/core/installer/app_manager.go b/core/installer/app_manager.go
index 4ed21f4..8bb072e 100644
--- a/core/installer/app_manager.go
+++ b/core/installer/app_manager.go
@@ -692,10 +692,12 @@
}
cfg = renderedCfg
r.RemoveAll(instanceDir)
- prev := ""
curr := instanceDir
- for prev != curr {
+ for {
p := filepath.Dir(curr)
+ if p == curr {
+ break
+ }
n := filepath.Base(curr)
kustPath := filepath.Join(p, "kustomization.yaml")
kust, err := soft.ReadKustomization(r, kustPath)
@@ -703,7 +705,7 @@
return "", err
}
kust.RemoveResources(n)
- if len(kust.Resources) > 0 {
+ if len(kust.Resources) > 0 || p == m.appDirRoot {
soft.WriteYaml(r, kustPath, kust)
break
} else {
@@ -711,7 +713,6 @@
return "", err
}
}
- prev = curr
curr = p
}
return fmt.Sprintf("uninstall: %s", instanceId), nil
diff --git a/core/installer/welcome/dodo_app.go b/core/installer/welcome/dodo_app.go
index 51f38e9..b02f7e9 100644
--- a/core/installer/welcome/dodo_app.go
+++ b/core/installer/welcome/dodo_app.go
@@ -1114,12 +1114,7 @@
return err
}
appPath := fmt.Sprintf("%s/%s", appName, branch)
- if _, err := configRepo.Do(func(fs soft.RepoFS) (string, error) {
- if err := m.Remove(appPath); err != nil {
- return "", err
- }
- return fmt.Sprintf("Uninstalled app branch: %s %s", appName, branch), nil
- }); err != nil {
+ if err := m.Remove(appPath); err != nil {
return err
}
if err := s.client.DeleteRepoBranch(appName, appBranch); err != nil {