Skip to content

Commit

Permalink
Fix double unquoting of install flags during host fact gathering phase (
Browse files Browse the repository at this point in the history
#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()`.
  • Loading branch information
janartodesk committed Oct 12, 2021
1 parent a4f267b commit a99331d
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions phase/gather_facts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package phase

import (
"fmt"
"strconv"

"github.com/k0sproject/k0sctl/config/cluster"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit a99331d

Please sign in to comment.