check uplink setup (#339)
* check uplink setup * code review comments changes
This commit is contained in:
parent
0567f9cb57
commit
3571886fe7
@ -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
|
||||
|
@ -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))
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user