Skip to content

Commit

Permalink
EVEREST-1795 Extend error message for CLI namespaces update command.
Browse files Browse the repository at this point in the history
Add hint how to make namespace managed by Everest
  • Loading branch information
maxkondr committed Jan 13, 2025
1 parent b668ff3 commit f58a4d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions commands/namespaces/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
package namespaces

import (
"errors"
"fmt"
"os"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit f58a4d0

Please sign in to comment.