vault operator init -output-curl-string bug (#17514)

* fixing -output-curl-string bug

* add changelog

* fix for -output-policy

* adding comment for -output-policy
This commit is contained in:
akshya96 2022-10-13 15:15:01 -07:00 committed by GitHub
parent 7bd4755142
commit 2d6c6c01c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

3
changelog/17514.txt Normal file
View File

@ -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
```

View File

@ -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 {