From 0cd7a7e03b39217604ad817ec65a5b054e0f2da9 Mon Sep 17 00:00:00 2001 From: Kimmo Lehto Date: Mon, 7 Mar 2022 13:41:34 +0200 Subject: [PATCH] Delete k0s config on reset (#342) * Delete k0s config on reset * Return original error * Restructure again --- phase/reset.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phase/reset.go b/phase/reset.go index d4b9435c..c75e429f 100644 --- a/phase/reset.go +++ b/phase/reset.go @@ -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") {