diff --git a/internal/agent/install.go b/internal/agent/install.go index 55e2bee..08ee320 100644 --- a/internal/agent/install.go +++ b/internal/agent/install.go @@ -26,7 +26,6 @@ import ( qr "github.com/mudler/go-nodepair/qrcode" "github.com/mudler/go-pluggable" "github.com/pterm/pterm" - "github.com/spf13/viper" "gopkg.in/yaml.v2" ) @@ -63,7 +62,7 @@ func mergeOption(cloudConfig string, r map[string]string) { } } -func ManualInstall(c string, options map[string]string, strictValidations, debug bool) error { +func ManualInstall(c string, options map[string]string, strictValidations bool) error { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -98,8 +97,6 @@ func ManualInstall(c string, options map[string]string, strictValidations, debug } } - // Set debug from here already, so it's loaded by the ReadConfigRun - viper.Set("debug", debug) // Load the installation Config from the system installConfig, err := elementalConfig.ReadConfigRun("/etc/elemental") if err != nil { @@ -109,7 +106,7 @@ func ManualInstall(c string, options map[string]string, strictValidations, debug return RunInstall(installConfig, options) } -func Install(debug bool, dir ...string) error { +func Install(dir ...string) error { utils.OnSignal(func() { svc, err := machine.Getty(1) if err == nil { @@ -133,8 +130,6 @@ func Install(debug bool, dir ...string) error { ensureDataSourceReady() - // Set debug from here already, so it's loaded by the ReadConfigRun - viper.Set("debug", debug) // Load the installation Config from the system installConfig, err := elementalConfig.ReadConfigRun("/etc/elemental") if err != nil { diff --git a/main.go b/main.go index 9d46c31..7c971b6 100644 --- a/main.go +++ b/main.go @@ -26,6 +26,7 @@ import ( "github.com/sirupsen/logrus" "github.com/Masterminds/semver/v3" + "github.com/spf13/viper" "github.com/urfave/cli/v2" "gopkg.in/yaml.v3" ) @@ -417,8 +418,7 @@ This command is meant to be used from the boot GRUB menu, but can be also starte if c.Bool("reboot") { options["reboot"] = "true" } - - return agent.ManualInstall(config, options, c.Bool("strict-validation"), c.Bool("debug")) + return agent.ManualInstall(config, options, c.Bool("strict-validation")) }, }, { @@ -434,7 +434,7 @@ See also https://kairos.io/docs/installation/qrcode/ for documentation. This command is meant to be used from the boot GRUB menu, but can be started manually`, Aliases: []string{"i"}, Action: func(c *cli.Context) error { - return agent.Install(c.Bool("debug"), configScanDir...) + return agent.Install(configScanDir...) }, }, { @@ -650,7 +650,11 @@ The kairos agent is a component to abstract away node ops, providing a common fe `, UsageText: ``, Copyright: "kairos authors", - + Before: func(c *cli.Context) error { + // Set debug from here already, so it's loaded by the ReadConfigRun + viper.Set("debug", c.Bool("debug")) + return nil + }, Commands: cmds, }