remove from-miner cmd (#11793)

This commit is contained in:
LexLuthr 2024-03-28 13:09:41 +04:00 committed by GitHub
parent 78d9d9baa0
commit 795ee314c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 110 deletions

View File

@ -31,7 +31,6 @@ var configCmd = &cli.Command{
configViewCmd,
configRmCmd,
configEditCmd,
configMigrateCmd,
configNewCmd,
},
}

View File

@ -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,
}

View File

@ -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
}

View File

@ -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: