From f58a4d0ecfb380a5535b20d5a72f2d2408deebe1 Mon Sep 17 00:00:00 2001 From: Maxim Kondratenko Date: Mon, 13 Jan 2025 15:08:23 +0200 Subject: [PATCH] EVEREST-1795 Extend error message for CLI `namespaces update` command. Add hint how to make namespace managed by Everest --- commands/namespaces/update.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/commands/namespaces/update.go b/commands/namespaces/update.go index 49c7b2f7e..fc316dc7f 100644 --- a/commands/namespaces/update.go +++ b/commands/namespaces/update.go @@ -2,6 +2,8 @@ package namespaces import ( + "errors" + "fmt" "os" "github.com/spf13/cobra" @@ -43,6 +45,12 @@ func NewUpdateCommand(l *zap.SugaredLogger) *cobra.Command { cmd.Flags().Lookup("operator.xtradb-cluster").Changed) if err := c.Populate(cmd.Context(), false, askOperators); err != nil { + if errors.Is(err, namespaces.ErrNamespaceNotManagedByEverest) { + err = fmt.Errorf("%w. HINT: use 'everestctl namespaces add --%s %s' first to make namespace managed by Everest", + err, + cli.FlagTakeNamespaceOwnership, + c.Namespaces) + } output.PrintError(err, l, !enableLogging) os.Exit(1) }