cmd/uplink/cmd/setup.go: Access Grant vs API Key error messaging
Provide a clearer error message to users who confuse the API Key with the Access Grant and suggest the right command to them. Change-Id: If73ae8cde140b68a19f4cfc3f59bb88a3b74c9c1
This commit is contained in:
parent
93e8413617
commit
d2148edcdb
@ -9,12 +9,14 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/zeebo/errs"
|
||||
|
||||
"storj.io/private/cfgstruct"
|
||||
"storj.io/private/process"
|
||||
"storj.io/storj/cmd/internal/wizard"
|
||||
"storj.io/uplink"
|
||||
"storj.io/uplink/backcomp"
|
||||
"storj.io/uplink/private/access2"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -108,7 +110,12 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
|
||||
access, err = backcomp.RequestAccessWithPassphraseAndConcurrency(ctx, uplinkConfig, satelliteAddress, apiKeyString, passphrase, uint8(setupCfg.PBKDFConcurrency))
|
||||
}
|
||||
if err != nil {
|
||||
return Error.Wrap(err)
|
||||
_, err2 := access2.ParseAccess(apiKeyString)
|
||||
if err2 == nil {
|
||||
err2 = Error.New("API key appears to be an access grant: try running `uplink import` instead")
|
||||
}
|
||||
|
||||
return errs.Combine(err, err2)
|
||||
}
|
||||
accessData, err := access.Serialize()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user