From 795ee314c00876101f3bf8c04b70ecfd9e1894c8 Mon Sep 17 00:00:00 2001 From: LexLuthr <88259624+LexLuthr@users.noreply.github.com> Date: Thu, 28 Mar 2024 13:09:41 +0400 Subject: [PATCH] remove from-miner cmd (#11793) --- cmd/curio/config.go | 1 - cmd/curio/main.go | 5 ++- cmd/curio/migrate.go | 70 ----------------------------------- documentation/en/cli-curio.md | 38 ------------------- 4 files changed, 4 insertions(+), 110 deletions(-) diff --git a/cmd/curio/config.go b/cmd/curio/config.go index 20f2d0597..2938118ad 100644 --- a/cmd/curio/config.go +++ b/cmd/curio/config.go @@ -31,7 +31,6 @@ var configCmd = &cli.Command{ configViewCmd, configRmCmd, configEditCmd, - configMigrateCmd, configNewCmd, }, } diff --git a/cmd/curio/main.go b/cmd/curio/main.go index 8c64af379..2175d24c5 100644 --- a/cmd/curio/main.go +++ b/cmd/curio/main.go @@ -25,6 +25,10 @@ import ( var log = logging.Logger("main") +const ( + FlagMinerRepo = "miner-repo" +) + func setupCloseHandler() { c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM) @@ -49,7 +53,6 @@ func main() { testCmd, webCmd, guidedsetup.GuidedsetupCmd, - configMigrateCmd, sealCmd, } diff --git a/cmd/curio/migrate.go b/cmd/curio/migrate.go index 5cf55bcb4..06ab7d0f9 100644 --- a/cmd/curio/migrate.go +++ b/cmd/curio/migrate.go @@ -1,71 +1 @@ package main - -import ( - "fmt" - - "github.com/urfave/cli/v2" - "golang.org/x/xerrors" - - cliutil "github.com/filecoin-project/lotus/cli/util" - "github.com/filecoin-project/lotus/cmd/curio/guidedsetup" - "github.com/filecoin-project/lotus/node/repo" -) - -var configMigrateCmd = &cli.Command{ - Name: "from-miner", - Usage: "Express a database config (for curio) from an existing miner.", - Description: "Express a database config (for curio) from an existing miner.", - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: FlagMinerRepo, - Aliases: []string{FlagMinerRepoDeprecation}, - EnvVars: []string{"LOTUS_MINER_PATH", "LOTUS_STORAGE_PATH"}, - Value: "~/.lotusminer", - Usage: fmt.Sprintf("Specify miner repo path. flag(%s) and env(LOTUS_STORAGE_PATH) are DEPRECATION, will REMOVE SOON", FlagMinerRepoDeprecation), - }, - &cli.StringFlag{ - Name: "repo", - EnvVars: []string{"LOTUS_PATH"}, - Hidden: true, - Value: "~/.lotus", - }, - &cli.StringFlag{ - Name: "to-layer", - Aliases: []string{"t"}, - Usage: "The layer name for this data push. 'base' is recommended for single-miner setup.", - }, - &cli.BoolFlag{ - Name: "overwrite", - Aliases: []string{"o"}, - Usage: "Use this with --to-layer to replace an existing layer", - }, - }, - Action: fromMiner, -} - -const ( - FlagMinerRepo = "miner-repo" -) - -const FlagMinerRepoDeprecation = "storagerepo" - -func fromMiner(cctx *cli.Context) (err error) { - minerRepoPath := cctx.String(FlagMinerRepo) - layerName := cctx.String("to-layer") - overwrite := cctx.Bool("overwrite") - - // Populate API Key - _, header, err := cliutil.GetRawAPI(cctx, repo.FullNode, "v0") - if err != nil { - return fmt.Errorf("cannot read API: %w", err) - } - - ainfo, err := cliutil.GetAPIInfo(&cli.Context{}, repo.FullNode) - if err != nil { - return xerrors.Errorf(`could not get API info for FullNode: %w - Set the environment variable to the value of "lotus auth api-info --perm=admin"`, err) - } - chainApiInfo := header.Get("Authorization")[7:] + ":" + ainfo.Addr - _, err = guidedsetup.SaveConfigToLayer(minerRepoPath, layerName, overwrite, chainApiInfo) - return err -} diff --git a/documentation/en/cli-curio.md b/documentation/en/cli-curio.md index 08ed8ab90..6976dfa2e 100644 --- a/documentation/en/cli-curio.md +++ b/documentation/en/cli-curio.md @@ -17,7 +17,6 @@ COMMANDS: test Utility functions for testing web Start Curio web interface guided-setup Run the guided setup for migrating from lotus-miner to Curio - from-miner Express a database config (for curio) from an existing miner. seal Manage the sealing pipeline version Print version help, h Shows a list of commands or help for one command @@ -106,7 +105,6 @@ COMMANDS: interpret, view, stacked, stack Interpret stacked config layers by this version of curio, with system-generated comments. remove, rm, del, delete Remove a named config layer. edit edit a config layer - from-miner Express a database config (for curio) from an existing miner. new-cluster Create new configuration for a new cluster help, h Shows a list of commands or help for one command @@ -206,24 +204,6 @@ OPTIONS: --help, -h show help ``` -### curio config from-miner -``` -NAME: - curio from-miner - Express a database config (for curio) from an existing miner. - -USAGE: - curio from-miner [command options] [arguments...] - -DESCRIPTION: - Express a database config (for curio) from an existing miner. - -OPTIONS: - --miner-repo value, --storagerepo value Specify miner repo path. flag(storagerepo) and env(LOTUS_STORAGE_PATH) are DEPRECATION, will REMOVE SOON (default: "~/.lotusminer") [$LOTUS_MINER_PATH, $LOTUS_STORAGE_PATH] - --to-layer value, -t value The layer name for this data push. 'base' is recommended for single-miner setup. - --overwrite, -o Use this with --to-layer to replace an existing layer (default: false) - --help, -h show help -``` - ### curio config new-cluster ``` NAME: @@ -334,24 +314,6 @@ OPTIONS: --help, -h show help ``` -## curio from-miner -``` -NAME: - curio from-miner - Express a database config (for curio) from an existing miner. - -USAGE: - curio from-miner [command options] [arguments...] - -DESCRIPTION: - Express a database config (for curio) from an existing miner. - -OPTIONS: - --miner-repo value, --storagerepo value Specify miner repo path. flag(storagerepo) and env(LOTUS_STORAGE_PATH) are DEPRECATION, will REMOVE SOON (default: "~/.lotusminer") [$LOTUS_MINER_PATH, $LOTUS_STORAGE_PATH] - --to-layer value, -t value The layer name for this data push. 'base' is recommended for single-miner setup. - --overwrite, -o Use this with --to-layer to replace an existing layer (default: false) - --help, -h show help -``` - ## curio seal ``` NAME: