From a99331d3c17c741fff4902dfa33a41645b3c9e83 Mon Sep 17 00:00:00 2001 From: Janar Todesk Date: Mon, 11 Oct 2021 20:07:11 +0300 Subject: [PATCH] Fix double unquoting of install flags during host fact gathering phase (#1) `--kubelet-extra-args` already get unquoted when being loaded via `cluster.Flags` type. Attempting to do so again during fact gathering phase will result in an obscure `invalid syntax` error returned by `strconv.Unquote()`. --- phase/gather_facts.go | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/phase/gather_facts.go b/phase/gather_facts.go index 1654bed5..18bf96a9 100644 --- a/phase/gather_facts.go +++ b/phase/gather_facts.go @@ -2,7 +2,6 @@ package phase import ( "fmt" - "strconv" "github.com/k0sproject/k0sctl/config/cluster" log "github.com/sirupsen/logrus" @@ -37,22 +36,12 @@ func (p *GatherFacts) investigateHost(h *cluster.Host) error { extra := h.InstallFlags.GetValue("--kubelet-extra-args") if extra != "" { - unq, err := strconv.Unquote(extra) - if err != nil { - return err - } - ef := cluster.Flags{unq} + ef := cluster.Flags{extra} if over := ef.GetValue("--hostname-override"); over != "" { - unq, err = strconv.Unquote(over) - if err != nil { - return err - } - if over != "" { - if h.HostnameOverride != unq { - return fmt.Errorf("hostname and installFlags kubelet-extra-args hostname-override mismatch, only define either one") - } - h.HostnameOverride = unq + if h.HostnameOverride != over { + return fmt.Errorf("hostname and installFlags kubelet-extra-args hostname-override mismatch, only define either one") } + h.HostnameOverride = over } }