Added operator raft and operator raft snapshot descriptions (#7106)

This commit is contained in:
Michel Vocks 2019-07-16 09:31:00 +02:00 committed by GitHub
parent 119854a865
commit 24e4f7eaaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 101 additions and 2 deletions

View File

@ -327,6 +327,11 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
ShutdownCh: MakeShutdownCh(),
}, nil
},
"operator raft": func() (cli.Command, error) {
return &OperatorRaftCommand{
BaseCommand: getBaseCommand(),
}, nil
},
"operator raft configuration": func() (cli.Command, error) {
return &OperatorRaftConfigurationCommand{
BaseCommand: getBaseCommand(),
@ -342,6 +347,11 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
BaseCommand: getBaseCommand(),
}, nil
},
"operator raft snapshot": func() (cli.Command, error) {
return &OperatorRaftSnapshotCommand{
BaseCommand: getBaseCommand(),
}, nil
},
"operator raft snapshot restore": func() (cli.Command, error) {
return &OperatorRaftSnapshotRestoreCommand{
BaseCommand: getBaseCommand(),

47
command/operator_raft.go Normal file
View File

@ -0,0 +1,47 @@
package command
import (
"strings"
"github.com/mitchellh/cli"
)
var _ cli.Command = (*OperatorRaftCommand)(nil)
type OperatorRaftCommand struct {
*BaseCommand
}
func (c *OperatorRaftCommand) Synopsis() string {
return "Interact with Vault's raft storage backend"
}
func (c *OperatorRaftCommand) Help() string {
helpText := `
Usage: vault operator raft <subcommand> [options] [args]
This command groups subcommands for operators interacting with the Vault raft storage backend. Most
users will not need to interact with these commands. Here are a few examples
of the raft operator commands:
Joins a node to the raft cluster:
$ vault operator raft join https://127.0.0.1:8200
Returns the raft cluster configuration:
$ vault operator raft configuration
Removes a node from the raft cluster:
$ vault operator raft remove-peer
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (c *OperatorRaftCommand) Run(args []string) int {
return cli.RunResultHelp
}

View File

@ -0,0 +1,42 @@
package command
import (
"strings"
"github.com/mitchellh/cli"
)
var _ cli.Command = (*OperatorRaftSnapshotCommand)(nil)
type OperatorRaftSnapshotCommand struct {
*BaseCommand
}
func (c *OperatorRaftSnapshotCommand) Synopsis() string {
return "Restores and saves snapshots from the raft cluster"
}
func (c *OperatorRaftSnapshotCommand) Help() string {
helpText := `
Usage: vault operator raft snapshot <subcommand> [options] [args]
This command groups subcommands for operators interacting with the snapshot functionality of
the raft storage backend. Here are a few examples of the raft snapshot operator commands:
Installs the provided snapshot, returning the cluster to the state defined in it:
$ vault operator raft snapshot restore raft.snap
Saves a snapshot of the current state of the raft cluster into a file:
$ vault operator raft snapshot save raft.snap
Please see the individual subcommand help for detailed usage information.
`
return strings.TrimSpace(helpText)
}
func (c *OperatorRaftSnapshotCommand) Run(args []string) int {
return cli.RunResultHelp
}

View File

@ -18,7 +18,7 @@ type OperatorRaftSnapshotRestoreCommand struct {
}
func (c *OperatorRaftSnapshotRestoreCommand) Synopsis() string {
return "Installs the provided snapshot, returning the cluster to the state defined in it."
return "Installs the provided snapshot, returning the cluster to the state defined in it"
}
func (c *OperatorRaftSnapshotRestoreCommand) Help() string {

View File

@ -17,7 +17,7 @@ type OperatorRaftSnapshotSaveCommand struct {
}
func (c *OperatorRaftSnapshotSaveCommand) Synopsis() string {
return "Saves a snapshot of the current state of the raft cluster into a file."
return "Saves a snapshot of the current state of the raft cluster into a file"
}
func (c *OperatorRaftSnapshotSaveCommand) Help() string {