diff --git a/cmd/airflow.go b/cmd/airflow.go index ff3bdd0da..781fb077f 100644 --- a/cmd/airflow.go +++ b/cmd/airflow.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/astronomer/astro-cli/cmd/utils" "os" "path/filepath" "regexp" @@ -130,7 +131,10 @@ func newDevRootCmd(platformCoreClient astroplatformcore.CoreClient, astroCoreCli // so we set that configuration in this persistent pre-run hook. // A few sub-commands don't require this, so they explicitly // clobber it with a no-op function. - PersistentPreRunE: ConfigureContainerRuntime, + PersistentPreRunE: utils.ChainRunEs( + SetupLogging, + ConfigureContainerRuntime, + ), } cmd.AddCommand( newAirflowInitCmd(), diff --git a/cmd/airflow_hooks.go b/cmd/airflow_hooks.go index d2172c164..743d108f2 100644 --- a/cmd/airflow_hooks.go +++ b/cmd/airflow_hooks.go @@ -6,7 +6,6 @@ import ( "path/filepath" "github.com/astronomer/astro-cli/airflow/runtimes" - softwareCmd "github.com/astronomer/astro-cli/cmd/software" "github.com/astronomer/astro-cli/cmd/utils" "github.com/astronomer/astro-cli/config" "github.com/spf13/cobra" @@ -29,10 +28,6 @@ func ConfigureContainerRuntime(_ *cobra.Command, _ []string) error { if err != nil { return err } - - if err := softwareCmd.SetUpLogs(os.Stdout, verboseLevel); err != nil { - return err - } return nil } diff --git a/cmd/root.go b/cmd/root.go index 30f4ef49d..d5b3d78c2 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -66,7 +66,7 @@ func NewRootCmd() *cobra.Command { Welcome to the Astro CLI, the modern command line interface for data orchestration. You can use it for Astro, Astronomer Software, or Local Development.`, PersistentPreRunE: utils.ChainRunEs( - SetupLoggingPersistentPreRunE, + SetupLogging, CreateRootPersistentPreRunE(astroCoreClient, platformCoreClient), ), } diff --git a/cmd/root_hooks.go b/cmd/root_hooks.go index 640ebc540..b97606c01 100644 --- a/cmd/root_hooks.go +++ b/cmd/root_hooks.go @@ -18,9 +18,9 @@ import ( "github.com/spf13/cobra" ) -// SetupLoggingPersistentPreRunE is a pre-run hook shared between software & cloud +// SetupLogging is a pre-run hook shared between software & cloud // setting up log verbosity. -func SetupLoggingPersistentPreRunE(_ *cobra.Command, _ []string) error { +func SetupLogging(_ *cobra.Command, _ []string) error { return softwareCmd.SetUpLogs(os.Stdout, verboseLevel) }