[VAULT-1324] Fix the CLI failing to return wrapping information for KV PUT and PATCH operations when format is set to 'table' (#22818)

This commit is contained in:
Kuba Wieczorek 2023-09-07 20:43:57 +01:00 committed by GitHub
parent db662131e7
commit 3130e8ba94
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)
}
// 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" {
outputPath(c.UI, fullPath, "Secret Path")
metadata := secret.Data

View file

@ -219,6 +219,11 @@ func (c *KVPutCommand) Run(args []string) int {
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" {
outputPath(c.UI, fullPath, "Secret Path")
metadata := secret.Data