Skip to content

Commit

Permalink
Delete k0s config on reset (#342)
Browse files Browse the repository at this point in the history
* Delete k0s config on reset

* Return original error

* Restructure again
  • Loading branch information
kke authored Mar 7, 2022
1 parent e6e8d94 commit 0cd7a7e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions phase/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func (p *Reset) Run() error {
out, err := h.ExecOutput(h.Configurer.K0sCmdf("reset"), exec.Sudo(h))
c, _ := semver.NewConstraint("<= 1.22.3+k0s.0")
running, _ := semver.NewVersion(h.Metadata.K0sBinaryVersion)

if dErr := h.Configurer.DeleteFile(h, h.Configurer.K0sConfigPath()); dErr != nil {
log.Warnf("%s: failed to remove existing configuration %s: %s", h, h.Configurer.K0sConfigPath(), dErr)
}

if err != nil {
log.Warnf("%s: k0s reported failure: %v", h, err)
if c.Check(running) && strings.Contains(out, "k0s cleanup operations done") {
Expand Down

0 comments on commit 0cd7a7e

Please sign in to comment.