backport of commit 3130e8ba9483e10e6191d264dc97b597462bf7c1 (#22868)

This commit is contained in:
hc-github-team-secure-vault-core 2023-09-07 16:08:01 -04:00 committed by GitHub
parent 2ae56bd4ac
commit d019802cc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

3
changelog/22818.txt Normal file
View file

@ -0,0 +1,3 @@
```release-note:bug
cli: Fix the CLI failing to return wrapping information for KV PUT and PATCH operations when format is set to `table`.
```

View file

@ -264,6 +264,11 @@ func (c *KVPatchCommand) Run(args []string) int {
return PrintRawField(c.UI, secret, c.flagField) return PrintRawField(c.UI, secret, c.flagField)
} }
// If the secret is wrapped, return the wrapped response.
if secret.WrapInfo != nil && secret.WrapInfo.TTL != 0 {
return OutputSecret(c.UI, secret)
}
if Format(c.UI) == "table" { if Format(c.UI) == "table" {
outputPath(c.UI, fullPath, "Secret Path") outputPath(c.UI, fullPath, "Secret Path")
metadata := secret.Data metadata := secret.Data

View file

@ -219,6 +219,11 @@ func (c *KVPutCommand) Run(args []string) int {
return PrintRawField(c.UI, secret, c.flagField) return PrintRawField(c.UI, secret, c.flagField)
} }
// If the secret is wrapped, return the wrapped response.
if secret.WrapInfo != nil && secret.WrapInfo.TTL != 0 {
return OutputSecret(c.UI, secret)
}
if Format(c.UI) == "table" { if Format(c.UI) == "table" {
outputPath(c.UI, fullPath, "Secret Path") outputPath(c.UI, fullPath, "Secret Path")
metadata := secret.Data metadata := secret.Data