diff --git a/pkg/bootstrap/isogen/command.go b/pkg/bootstrap/isogen/command.go index ee784fc90..a1bbb375e 100644 --- a/pkg/bootstrap/isogen/command.go +++ b/pkg/bootstrap/isogen/command.go @@ -71,7 +71,7 @@ func GenerateBootstrapIso(settings *environment.AirshipCTLSettings) error { return err } - err = generateBootstrapIso(docBundle, builder, cfg, settings.Debug) + err = generateBootstrapIso(docBundle, builder, cfg, log.DebugEnabled()) if err != nil { return err } diff --git a/pkg/clusterctl/client/executor.go b/pkg/clusterctl/client/executor.go index 695f6e6d5..d50159e47 100644 --- a/pkg/clusterctl/client/executor.go +++ b/pkg/clusterctl/client/executor.go @@ -61,7 +61,7 @@ func NewExecutor(cfg ifc.ExecutorConfig) (ifc.Executor, error) { if err != nil { return nil, err } - client, err := NewClient(tgtPath, cfg.AirshipSettings.Debug, options) + client, err := NewClient(tgtPath, log.DebugEnabled(), options) if err != nil { return nil, err } diff --git a/pkg/clusterctl/cmd/command.go b/pkg/clusterctl/cmd/command.go index 540bcbe49..5982328d9 100644 --- a/pkg/clusterctl/cmd/command.go +++ b/pkg/clusterctl/cmd/command.go @@ -20,6 +20,7 @@ import ( "opendev.org/airship/airshipctl/pkg/config" "opendev.org/airship/airshipctl/pkg/document" "opendev.org/airship/airshipctl/pkg/environment" + "opendev.org/airship/airshipctl/pkg/log" ) // Command adds a layer to clusterctl interface with airshipctl context @@ -48,7 +49,7 @@ func NewCommand(rs *environment.AirshipCTLSettings) (*Command, error) { if err != nil { return nil, err } - client, err := client.NewClient(root, rs.Debug, options) + client, err := client.NewClient(root, log.DebugEnabled(), options) if err != nil { return nil, err } diff --git a/pkg/log/log.go b/pkg/log/log.go index e0322d3cd..7d1e0dced 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -31,6 +31,11 @@ func Init(debugFlag bool, out io.Writer) { airshipLog.SetOutput(out) } +// DebugEnabled returns whether the debug level is set +func DebugEnabled() bool { + return debug +} + // Debug is a wrapper for log.Debug func Debug(v ...interface{}) { if debug { diff --git a/pkg/phase/phase.go b/pkg/phase/phase.go index 571743702..e8d2ad740 100644 --- a/pkg/phase/phase.go +++ b/pkg/phase/phase.go @@ -175,7 +175,7 @@ func (p *Cmd) Exec(name string) error { return } executor.Run(runCh, ifc.RunOptions{ - Debug: p.Debug, + Debug: log.DebugEnabled(), DryRun: p.DryRun, }) }()