[#1424] neofs-cli: Fail immediately if a key can't be fetched

If the key can't be fetched, an error is always returned, so it makes
sense to fail the whole command inside of a `key.Get*()`.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-05-24 11:22:23 +03:00 committed by LeL
parent d9c5ca5e77
commit 295ec3700a
19 changed files with 70 additions and 69 deletions

View file

@ -6,6 +6,7 @@ import (
internalclient "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/client"
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/common"
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/commonflags"
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/key"
objectcore "github.com/nspcc-dev/neofs-node/pkg/core/object"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
"github.com/nspcc-dev/neofs-sdk-go/object"
@ -34,8 +35,7 @@ var cmdObjectLock = &cobra.Command{
common.ExitOnErr(cmd, fmt.Sprintf("Incorrect object arg #%d: %%v", i+1), err)
}
key, err := getKey()
common.ExitOnErr(cmd, "can't fetch private key: %w", err)
key := key.GetOrGenerate(cmd)
idOwner, err := getOwnerID(key)
common.ExitOnErr(cmd, "", err)