diff --git a/changelog/17514.txt b/changelog/17514.txt new file mode 100644 index 000000000..215ea8329 --- /dev/null +++ b/changelog/17514.txt @@ -0,0 +1,3 @@ +```release-note:bug +core: Fix vault operator init command to show the right curl string with -output-curl-string and right policy hcl with -output-policy +``` \ No newline at end of file diff --git a/command/operator_init.go b/command/operator_init.go index 6d67dcd9b..3b0dfe3de 100644 --- a/command/operator_init.go +++ b/command/operator_init.go @@ -237,6 +237,15 @@ func (c *OperatorInitCommand) Run(args []string) int { return 2 } + // -output-curl string returns curl command for seal status + // setting this to false and then setting actual value after reading seal status + currentOutputCurlString := client.OutputCurlString() + client.SetOutputCurlString(false) + // -output-policy string returns minimum required policy HCL for seal status + // setting this to false and then setting actual value after reading seal status + outputPolicy := client.OutputPolicy() + client.SetOutputPolicy(false) + // Set defaults based on use of auto unseal seal sealInfo, err := client.Sys().SealStatus() if err != nil { @@ -244,6 +253,9 @@ func (c *OperatorInitCommand) Run(args []string) int { return 2 } + client.SetOutputCurlString(currentOutputCurlString) + client.SetOutputPolicy(outputPolicy) + switch sealInfo.RecoverySeal { case true: if c.flagRecoveryShares == 0 {