From 81070ada01cc071dc1f211d852ff0d0667605454 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Wed, 26 Jun 2024 14:44:41 +0300 Subject: [PATCH] [#1091] cli: Check `NotFound` properly for `control list-targets` Signed-off-by: Anton Nikiforov --- cmd/frostfs-cli/modules/control/list_targets.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/frostfs-cli/modules/control/list_targets.go b/cmd/frostfs-cli/modules/control/list_targets.go index ddd80b31..6a988c35 100644 --- a/cmd/frostfs-cli/modules/control/list_targets.go +++ b/cmd/frostfs-cli/modules/control/list_targets.go @@ -13,6 +13,8 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/control" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" "github.com/spf13/cobra" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) const ( @@ -52,6 +54,10 @@ func listTargets(cmd *cobra.Command, _ []string) { resp, err = control.ListTargetsLocalOverrides(client, req) return err }) + if err != nil && status.Code(err) == codes.NotFound { + cmd.Println("Local overrides are not defined for any target.") + return + } commonCmd.ExitOnErr(cmd, "rpc error: %w", err) verifyResponse(cmd, resp.GetSignature(), resp.GetBody())