From 7c1a0ad8bc133d7f1f249fdbeea85efe007ef53a Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Thu, 17 Nov 2022 04:25:27 -0500 Subject: [PATCH] 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) --- command/commands.go | 9 --------- command/operator_diagnose.go | 2 -- command/server.go | 29 ----------------------------- 3 files changed, 40 deletions(-) diff --git a/command/commands.go b/command/commands.go index 40dc937eb0..98c06d70ef 100644 --- a/command/commands.go +++ b/command/commands.go @@ -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) } diff --git a/command/operator_diagnose.go b/command/operator_diagnose.go index 3746b5845f..df5af11d94 100644 --- a/command/operator_diagnose.go +++ b/command/operator_diagnose.go @@ -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 ( diff --git a/command/server.go b/command/server.go index 52ecec5d0e..ffb54ccbe2 100644 --- a/command/server.go +++ b/command/server.go @@ -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