Unverified Commit 5e9d0221 authored by Nick Cabatoff's avatar Nick Cabatoff Committed by GitHub
Browse files

Make the `list` and `kv list` commands work with wrapping, e.g. for controlgroups (#12031)

parent 8182d1d3
Showing with 13 additions and 10 deletions
+13 -10
```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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment