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 11, 2021
1 parent a4f267b commit 52ebefa
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 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,21 +36,13 @@ 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 {
if h.HostnameOverride != over {
return fmt.Errorf("hostname and installFlags kubelet-extra-args hostname-override mismatch, only define either one")
}
h.HostnameOverride = unq
h.HostnameOverride = over
}
}
}
Expand Down

0 comments on commit 52ebefa

Please sign in to comment.