forked from TrueCloudLab/frostfs-node
Evgenii Stratonikov
f45e75e3eb
We bind flag that could be specified in config.
This is not a config flag, just a command option.
Also fix TestInitialize failures:
```
Error: Received unexpected error:
number of epochs cannot be less than 1
Test: TestInitialize/16_nodes/force-new-epoch
```
Refs #1372 (945b7c740b
)
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
44 lines
1.6 KiB
Go
44 lines
1.6 KiB
Go
package netmap
|
|
|
|
import (
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/commonflags"
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
var (
|
|
CandidatesCmd = &cobra.Command{
|
|
Use: "netmap-candidates",
|
|
Short: "List netmap candidates nodes",
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
|
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
},
|
|
Run: listNetmapCandidatesNodes,
|
|
}
|
|
ForceNewEpoch = &cobra.Command{
|
|
Use: "force-new-epoch",
|
|
Short: "Create new FrostFS epoch event in the side chain",
|
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
|
_ = viper.BindPFlag(commonflags.AlphabetWalletsFlag, cmd.Flags().Lookup(commonflags.AlphabetWalletsFlag))
|
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
|
},
|
|
RunE: ForceNewEpochCmd,
|
|
}
|
|
)
|
|
|
|
func initNetmapCandidatesCmd() {
|
|
CandidatesCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
|
}
|
|
|
|
func initForceNewEpochCmd() {
|
|
ForceNewEpoch.Flags().String(commonflags.AlphabetWalletsFlag, "", commonflags.AlphabetWalletsFlagDesc)
|
|
ForceNewEpoch.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
|
ForceNewEpoch.Flags().String(commonflags.LocalDumpFlag, "", "Path to the blocks dump file")
|
|
ForceNewEpoch.Flags().Int64(commonflags.DeltaFlag, 1, "Number of epochs to increase the current epoch")
|
|
}
|
|
|
|
func init() {
|
|
initNetmapCandidatesCmd()
|
|
initForceNewEpochCmd()
|
|
}
|