fix(clustertool): add commands debug and allow for extra args

This commit is contained in:
Kjeld Schouten
2024-11-06 22:25:50 +01:00
parent eb1e7440dc
commit a11f019d6e
6 changed files with 27 additions and 9 deletions
+7 -4
View File
@@ -1,27 +1,30 @@
package gencmd
import (
"strings"
"github.com/rs/zerolog/log"
"github.com/truecharts/public/clustertool/embed"
"github.com/truecharts/public/clustertool/pkg/helper"
"github.com/truecharts/public/clustertool/pkg/talassist"
)
func GenPlain(command string, node string, extraFlags []string) []string {
func GenPlain(command string, node string, extraArgs []string) []string {
commands := []string{}
//extraFlags = append(extraFlags, "--preserve")
talosPath := embed.GetTalosExec()
if node == "" {
for _, noderef := range talassist.TalConfig.Nodes {
// TODO add extraFlags
cmd := talosPath + " " + command + " --talosconfig " + helper.TalosConfigFile + " -n " + noderef.IPAddress + " "
cmd := talosPath + " " + command + " --talosconfig " + helper.TalosConfigFile + " -n " + noderef.IPAddress + " " + strings.Join(extraArgs, " ")
commands = append(commands, cmd)
}
} else {
cmd := talosPath + " " + command + " --talosconfig " + helper.TalosConfigFile + " -n " + node + " "
cmd := talosPath + " " + command + " --talosconfig " + helper.TalosConfigFile + " -n " + node + " " + strings.Join(extraArgs, " ")
commands = append(commands, cmd)
}
log.Debug().Msgf("%s Command rendered: %s", command, commands)
return commands
}