Skip to content

Commit

Permalink
Fix minor bugs in lotus shed datastore subcommand
Browse files Browse the repository at this point in the history
* Use consistent pattern to pick `namespace`: the cleaned datastore key
  vs. direct user input. This way `metadata` for example would work
  consistently. Otherwise, `clear`, `export` and `import` wont work
  unless `/metadata` is specified.

* Fix minor bug on number of arguments required for `clear` command.
  • Loading branch information
masih committed Nov 13, 2024
1 parent 6b4cc35 commit a79b63d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/lotus-shed/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ var datastoreClearCmd = &cli.Command{
},
ArgsUsage: "[namespace]",
Action: func(cctx *cli.Context) (_err error) {
if cctx.NArg() != 2 {
return xerrors.Errorf("requires 2 arguments: the datastore prefix")
if cctx.NArg() != 1 {
return xerrors.Errorf("requires 1 argument: the datastore prefix")
}
namespace := cctx.Args().Get(0)

Expand All @@ -157,7 +157,7 @@ var datastoreClearCmd = &cli.Command{
}
defer lr.Close() //nolint:errcheck

ds, err := lr.Datastore(cctx.Context, namespace)
ds, err := lr.Datastore(cctx.Context, datastore.NewKey(namespace).String())
if err != nil {
return err
}
Expand Down Expand Up @@ -306,7 +306,7 @@ var datastoreExportCmd = &cli.Command{
}
defer lr.Close() //nolint:errcheck

ds, err := lr.Datastore(cctx.Context, namespace)
ds, err := lr.Datastore(cctx.Context, datastore.NewKey(namespace).String())
if err != nil {
return err
}
Expand Down Expand Up @@ -389,7 +389,7 @@ var datastoreImportCmd = &cli.Command{
}
defer lr.Close() //nolint:errcheck

ds, err := lr.Datastore(cctx.Context, namespace)
ds, err := lr.Datastore(cctx.Context, datastore.NewKey(namespace).String())
if err != nil {
return err
}
Expand Down

0 comments on commit a79b63d

Please sign in to comment.