forked from TrueCloudLab/frostfs-node
[#1091] cli: Check NotFound
properly for control list-targets
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
a0e5fc733e
commit
ec09462faf
1 changed files with 6 additions and 0 deletions
|
@ -13,6 +13,8 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/control"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/control"
|
||||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -52,6 +54,10 @@ func listTargets(cmd *cobra.Command, _ []string) {
|
||||||
resp, err = control.ListTargetsLocalOverrides(client, req)
|
resp, err = control.ListTargetsLocalOverrides(client, req)
|
||||||
return err
|
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)
|
commonCmd.ExitOnErr(cmd, "rpc error: %w", err)
|
||||||
|
|
||||||
verifyResponse(cmd, resp.GetSignature(), resp.GetBody())
|
verifyResponse(cmd, resp.GetSignature(), resp.GetBody())
|
||||||
|
|
Loading…
Reference in a new issue