I think there was a plan at some point to support a "vault server -diagnose" command line option, but that doesn't seem to have ever come to pass. Removing the dead code. (#17983)

This commit is contained in:
Nick Cabatoff 2022-11-17 04:25:27 -05:00 committed by GitHub
parent 3667f4b6a1
commit 7c1a0ad8bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 40 deletions

View file

@ -794,15 +794,6 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
},
}
// Disabled by default until functional
if os.Getenv(OperatorDiagnoseEnableEnv) != "" {
Commands["operator diagnose"] = func() (cli.Command, error) {
return &OperatorDiagnoseCommand{
BaseCommand: getBaseCommand(),
}, nil
}
}
initCommandsEnt(ui, serverCmdUi, runOpts)
}

View file

@ -38,8 +38,6 @@ import (
"github.com/posener/complete"
)
const OperatorDiagnoseEnableEnv = "VAULT_DIAGNOSE"
const CoreConfigUninitializedErr = "Diagnose cannot attempt this step because core config could not be set."
var (

View file

@ -140,7 +140,6 @@ type ServerCommand struct {
flagTestServerConfig bool
flagDevConsul bool
flagExitOnCoreShutdown bool
flagDiagnose string
}
func (c *ServerCommand) Synopsis() string {
@ -223,19 +222,6 @@ func (c *ServerCommand) Flags() *FlagSets {
"Using a recovery operation token, \"sys/raw\" API can be used to manipulate the storage.",
})
// Disabled by default until functional
if os.Getenv(OperatorDiagnoseEnableEnv) != "" {
f.StringVar(&StringVar{
Name: "diagnose",
Target: &c.flagDiagnose,
Default: notSetValue,
Usage: "Run diagnostics before starting Vault. Specify a filename to direct output to that file.",
})
} else {
// Ensure diagnose is *not* run when feature flag is off.
c.flagDiagnose = notSetValue
}
f = set.NewFlagSet("Dev Options")
f.BoolVar(&BoolVar{
@ -1063,21 +1049,6 @@ func (c *ServerCommand) Run(args []string) int {
}
}
if c.flagDiagnose != notSetValue {
if c.flagDev {
c.UI.Error("Cannot run diagnose on Vault in dev mode.")
return 1
}
// TODO: add a file output flag to Diagnose
diagnose := &OperatorDiagnoseCommand{
BaseCommand: c.BaseCommand,
flagDebug: false,
flagSkips: []string{},
flagConfigs: c.flagConfigs,
}
diagnose.RunWithParsedFlags()
}
// Load the configuration
var config *server.Config
var err error