diff --git a/internal/cmd/config/profile/set/set.go b/internal/cmd/config/profile/set/set.go index baa650362..3594883fe 100644 --- a/internal/cmd/config/profile/set/set.go +++ b/internal/cmd/config/profile/set/set.go @@ -50,15 +50,16 @@ func NewCmd(p *print.Printer) *cobra.Command { return fmt.Errorf("set profile: %w", err) } + p.Info("Successfully set active profile to %q\n", model.Profile) + flow, err := auth.GetAuthFlow() if err != nil { p.Debug(print.WarningLevel, "both keyring and text file storage failed to find a valid authentication flow for the active profile") p.Warn("The active profile %q is not authenticated, please login using the 'stackit auth login' command.\n", model.Profile) - } else { - p.Debug(print.DebugLevel, "found valid authentication flow for active profile: %s", flow) + return nil } + p.Debug(print.DebugLevel, "found valid authentication flow for active profile: %s", flow) - p.Info("Successfully set active profile to %q\n", model.Profile) return nil }, } diff --git a/internal/cmd/config/profile/unset/unset.go b/internal/cmd/config/profile/unset/unset.go index 6c30e53e1..f767cbfe4 100644 --- a/internal/cmd/config/profile/unset/unset.go +++ b/internal/cmd/config/profile/unset/unset.go @@ -32,15 +32,16 @@ func NewCmd(p *print.Printer) *cobra.Command { return fmt.Errorf("unset profile: %w", err) } + p.Info("Profile unset successfully. The default profile will be used.\n") + flow, err := auth.GetAuthFlow() if err != nil { p.Debug(print.WarningLevel, "both keyring and text file storage failed to find a valid authentication flow for the active profile") p.Warn("The default profile is not authenticated, please login using the 'stackit auth login' command.\n") - } else { - p.Debug(print.DebugLevel, "found valid authentication flow for active profile: %s", flow) + return nil } + p.Debug(print.DebugLevel, "found valid authentication flow for active profile: %s", flow) - p.Info("Profile unset successfully. The default profile will be used.\n") return nil }, }