Merge pull request #10280 from filecoin-project/asr/fix-shed

fix: shed: default to LOTUS_PATH for repo
This commit is contained in:
Łukasz Magiera 2023-02-15 18:57:15 +01:00 committed by GitHub
commit 2dd2edc1d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 74 additions and 100 deletions

View File

@ -454,9 +454,8 @@ var chainBalanceStateCmd = &cli.Command{
Description: "Produces a csv file of all account balances from a given stateroot",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.BoolFlag{
Name: "miner-info",
@ -678,9 +677,8 @@ var chainPledgeCmd = &cli.Command{
Description: "Calculate sector pledge numbers",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
ArgsUsage: "[stateroot epoch]",

View File

@ -41,11 +41,6 @@ var datastoreListCmd = &cli.Command{
Name: "list",
Description: "list datastore keys",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "repo-type",
Usage: "node type (FullNode, StorageMiner, Worker, Wallet)",
@ -115,11 +110,6 @@ var datastoreGetCmd = &cli.Command{
Name: "get",
Description: "list datastore keys",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
&cli.StringFlag{
Name: "repo-type",
Usage: "node type (FullNode, StorageMiner, Worker, Wallet)",
@ -133,7 +123,7 @@ var datastoreGetCmd = &cli.Command{
},
ArgsUsage: "[namespace key]",
Action: func(cctx *cli.Context) error {
_ = logging.SetLogLevel("badger", "ERROR")
logging.SetLogLevel("badger", "ERROR") // nolint:errcheck
r, err := repo.NewFS(cctx.String("repo"))
if err != nil {

View File

@ -24,9 +24,8 @@ var dealLabelCmd = &cli.Command{
Usage: "Scrape state to report on how many deals have non UTF-8 labels",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
Action: func(cctx *cli.Context) error {

View File

@ -33,9 +33,8 @@ var diffMinerStates = &cli.Command{
ArgsUsage: "<stateCidA> <stateCidB>",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
Action: func(cctx *cli.Context) error {

View File

@ -35,9 +35,8 @@ var exportCarCmd = &cli.Command{
Description: "Export a car from repo",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
ArgsUsage: "[outfile] [root cid]",

View File

@ -42,9 +42,8 @@ var exportChainCmd = &cli.Command{
Description: "Export chain from repo (requires node to be offline)",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.StringFlag{
Name: "tipset",
@ -147,9 +146,8 @@ var exportRawCmd = &cli.Command{
Description: "Export raw blocks from repo (requires node to be offline)",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.StringFlag{
Name: "car-size",

View File

@ -58,6 +58,12 @@ var fip36PollCmd = &cli.Command{
Name: "fip36poll",
Usage: "Process the FIP0036 FilPoll result",
ArgsUsage: "[state root, votes]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
},
},
Subcommands: []*cli.Command{
finalResultCmd,
},
@ -69,9 +75,8 @@ var finalResultCmd = &cli.Command{
ArgsUsage: "[state root] [height] [votes json]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},

View File

@ -42,9 +42,8 @@ var gasTraceCmd = &cli.Command{
ArgsUsage: "[migratedStateRootCid networkVersion messageCid]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
Action: func(cctx *cli.Context) error {
@ -147,9 +146,8 @@ var replayOfflineCmd = &cli.Command{
ArgsUsage: "[messageCid]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.Int64Flag{
Name: "lookback-limit",

View File

@ -19,13 +19,6 @@ import (
var importCarCmd = &cli.Command{
Name: "import-car",
Description: "Import a car file into node chain blockstore",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
r, err := repo.NewFS(cctx.String("repo"))
if err != nil {
@ -103,13 +96,6 @@ var importCarCmd = &cli.Command{
var importObjectCmd = &cli.Command{
Name: "import-obj",
Usage: "import a raw ipld object into your datastore",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
r, err := repo.NewFS(cctx.String("repo"))
if err != nil {

View File

@ -35,9 +35,8 @@ var invariantsCmd = &cli.Command{
ArgsUsage: "[StateRootCid, height]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
Action: func(cctx *cli.Context) error {

View File

@ -146,14 +146,9 @@ var keyinfoImportCmd = &cli.Command{
Examples
env LOTUS_PATH=/var/lib/lotus lotus-shed keyinfo import libp2p-host.keyinfo`,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
},
},
Action: func(cctx *cli.Context) error {
flagRepo := cctx.String("repo")
var input io.Reader
if cctx.NArg() == 0 {
input = os.Stdin
@ -182,7 +177,7 @@ var keyinfoImportCmd = &cli.Command{
return err
}
fsrepo, err := repo.NewFS(cctx.String("repo"))
fsrepo, err := repo.NewFS(flagRepo)
if err != nil {
return err
}

View File

@ -1,6 +1,7 @@
package main
import (
"fmt"
"os"
logging "github.com/ipfs/go-log/v2"
@ -88,6 +89,19 @@ func main() {
Version: build.UserVersion(),
Commands: local,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
EnvVars: []string{"LOTUS_PATH"},
Hidden: true,
Value: "~/.lotus", // TODO: Consider XDG_DATA_HOME
},
&cli.StringFlag{
Name: "miner-repo",
Aliases: []string{"storagerepo"},
EnvVars: []string{"LOTUS_MINER_PATH", "LOTUS_STORAGE_PATH"},
Value: "~/.lotusminer", // TODO: Consider XDG_DATA_HOME
Usage: fmt.Sprintf("Specify miner repo path. flag storagerepo and env LOTUS_STORAGE_PATH are DEPRECATION, will REMOVE SOON"),
},
&cli.StringFlag{
Name: "log-level",
Value: "info",

View File

@ -124,9 +124,8 @@ var marketExportDatastoreCmd = &cli.Command{
Description: "export markets datastore key/values to a file",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Usage: "path to the repo",
},
&cli.StringFlag{
Name: "backup-dir",
@ -242,9 +241,8 @@ var marketImportDatastoreCmd = &cli.Command{
Description: "import markets datastore key/values from a backup file",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Usage: "path to the repo",
},
&cli.StringFlag{
Name: "backup-path",

View File

@ -54,9 +54,8 @@ var migrationsCmd = &cli.Command{
ArgsUsage: "[new network version, block to look back from]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.BoolFlag{
Name: "skip-pre-migration",

View File

@ -26,12 +26,10 @@ import (
var minerPeeridCmd = &cli.Command{
Name: "miner-peerid",
Usage: "Scrape state to find a miner based on peerid",
Flags: []cli.Flag{
Usage: "Scrape state to find a miner based on peerid", Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
Action: func(cctx *cli.Context) error {

View File

@ -28,12 +28,10 @@ import (
var minerTypesCmd = &cli.Command{
Name: "miner-types",
Usage: "Scrape state to report on how many miners of each WindowPoStProofType exist",
Flags: []cli.Flag{
Usage: "Scrape state to report on how many miners of each WindowPoStProofType exist", Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
Action: func(cctx *cli.Context) error {

View File

@ -43,9 +43,8 @@ var multisigGetAllCmd = &cli.Command{
ArgsUsage: "[state root]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
Action: func(cctx *cli.Context) error {

View File

@ -17,6 +17,12 @@ import (
var noncefix = &cli.Command{
Name: "noncefix",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
EnvVars: []string{"LOTUS_PATH"},
Hidden: true,
Value: "~/.lotus", // TODO: Consider XDG_DATA_HOME
},
&cli.Uint64Flag{
Name: "start",
},

View File

@ -86,9 +86,8 @@ var stateTreePruneCmd = &cli.Command{
Description: "Deletes old state root data from local chainstore",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.Int64Flag{
Name: "keep-from-lookback",

View File

@ -39,9 +39,8 @@ var splitstoreRollbackCmd = &cli.Command{
Description: "rollbacks a splitstore installation",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.BoolFlag{
Name: "gc-coldstore",
@ -130,9 +129,8 @@ var splitstoreClearCmd = &cli.Command{
Description: "clears a splitstore installation for restart from snapshot",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
&cli.BoolFlag{
Name: "keys-only",

View File

@ -33,9 +33,8 @@ var terminationsCmd = &cli.Command{
ArgsUsage: "[block to look back from] [lookback period (epochs)]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "repo",
Value: "~/.lotus",
EnvVars: []string{"LOTUS_PATH"},
Name: "repo",
Value: "~/.lotus",
},
},
Action: func(cctx *cli.Context) error {