diff --git a/cmd/uplink/cmd/ls.go b/cmd/uplink/cmd/ls.go index a6d117342..a6542bc22 100644 --- a/cmd/uplink/cmd/ls.go +++ b/cmd/uplink/cmd/ls.go @@ -78,7 +78,7 @@ func list(cmd *cobra.Command, args []string) error { } if noBuckets { - return fmt.Errorf("No buckets") + fmt.Println("No buckets") } return nil diff --git a/cmd/uplink/cmd/run.go b/cmd/uplink/cmd/run.go index 8366a3196..ccd8c8002 100644 --- a/cmd/uplink/cmd/run.go +++ b/cmd/uplink/cmd/run.go @@ -4,6 +4,7 @@ package cmd import ( + "errors" "fmt" "net" @@ -39,5 +40,16 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) { fmt.Printf("Access key: %s\n", cfg.AccessKey) fmt.Printf("Secret key: %s\n", cfg.SecretKey) + ctx := process.Ctx(cmd) + bs, err := cfg.BucketStore(ctx) + if err != nil { + return err + } + + _, _, err = bs.List(ctx, "", "", 0) + if err != nil { + return errors.New("uplink setup error") + } + return cfg.Run(process.Ctx(cmd)) } diff --git a/pkg/storage/buckets/store.go b/pkg/storage/buckets/store.go index 3e40dcd5c..2fa65be10 100644 --- a/pkg/storage/buckets/store.go +++ b/pkg/storage/buckets/store.go @@ -122,6 +122,9 @@ func (b *BucketStore) List(ctx context.Context, startAfter, endBefore string, li items []ListItem, more bool, err error) { defer mon.Task()(&ctx)(&err) objItems, more, err := b.o.List(ctx, nil, paths.New(startAfter), paths.New(endBefore), false, limit, meta.Modified) + if err != nil { + return items, more, err + } items = make([]ListItem, 0, len(objItems)) for _, itm := range objItems { if itm.IsPrefix {