Make the `list` and `kv list` commands work with wrapping, e.g. for controlgroups (#12031)
This commit is contained in:
parent
349378454a
commit
518944c599
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
cli: Add support for response wrapping in `vault list` and `vault kv list` with output format other than `table`.
|
||||
```
|
|
@ -103,6 +103,11 @@ func (c *KVListCommand) Run(args []string) int {
|
|||
return 2
|
||||
}
|
||||
|
||||
// If the secret is wrapped, return the wrapped response.
|
||||
if secret != nil && secret.WrapInfo != nil && secret.WrapInfo.TTL != 0 {
|
||||
return OutputSecret(c.UI, secret)
|
||||
}
|
||||
|
||||
_, ok := extractListData(secret)
|
||||
if Format(c.UI) != "table" {
|
||||
if secret == nil || secret.Data == nil || !ok {
|
||||
|
@ -116,11 +121,6 @@ func (c *KVListCommand) Run(args []string) int {
|
|||
return 2
|
||||
}
|
||||
|
||||
// If the secret is wrapped, return the wrapped response.
|
||||
if secret.WrapInfo != nil && secret.WrapInfo.TTL != 0 {
|
||||
return OutputSecret(c.UI, secret)
|
||||
}
|
||||
|
||||
if !ok {
|
||||
c.UI.Error(fmt.Sprintf("No entries found at %s", path))
|
||||
return 2
|
||||
|
|
|
@ -90,6 +90,11 @@ func (c *ListCommand) Run(args []string) int {
|
|||
return 2
|
||||
}
|
||||
|
||||
// If the secret is wrapped, return the wrapped response.
|
||||
if secret != nil && secret.WrapInfo != nil && secret.WrapInfo.TTL != 0 {
|
||||
return OutputSecret(c.UI, secret)
|
||||
}
|
||||
|
||||
_, ok := extractListData(secret)
|
||||
if Format(c.UI) != "table" {
|
||||
if secret == nil || secret.Data == nil || !ok {
|
||||
|
@ -108,11 +113,6 @@ func (c *ListCommand) Run(args []string) int {
|
|||
return OutputSecret(c.UI, secret)
|
||||
}
|
||||
|
||||
// If the secret is wrapped, return the wrapped response.
|
||||
if secret.WrapInfo != nil && secret.WrapInfo.TTL != 0 {
|
||||
return OutputSecret(c.UI, secret)
|
||||
}
|
||||
|
||||
if !ok {
|
||||
c.UI.Error(fmt.Sprintf("No entries found at %s", path))
|
||||
return 2
|
||||
|
|
Loading…
Reference in New Issue