mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Sync some ns stuff to api/command
This commit is contained in:
@@ -66,19 +66,29 @@ func (c *NamespaceListCommand) Run(args []string) int {
|
||||
return 2
|
||||
}
|
||||
|
||||
namespaces, err := client.Sys().ListNamespaces()
|
||||
secret, err := client.Logical().List("sys/namespaces")
|
||||
if err != nil {
|
||||
c.UI.Error(fmt.Sprintf("Error listing namespaces: %s", err))
|
||||
return 2
|
||||
}
|
||||
|
||||
switch Format(c.UI) {
|
||||
case "table":
|
||||
for _, ns := range namespaces.NamespacePaths {
|
||||
c.UI.Output(ns)
|
||||
}
|
||||
return 0
|
||||
default:
|
||||
return OutputData(c.UI, namespaces)
|
||||
if secret == nil {
|
||||
c.UI.Error(fmt.Sprintf("No namespaces found"))
|
||||
return 2
|
||||
}
|
||||
|
||||
// There could be e.g. warnings
|
||||
if secret.Data == nil {
|
||||
return OutputSecret(c.UI, secret)
|
||||
}
|
||||
|
||||
if secret.WrapInfo != nil && secret.WrapInfo.TTL != 0 {
|
||||
return OutputSecret(c.UI, secret)
|
||||
}
|
||||
|
||||
if _, ok := extractListData(secret); !ok {
|
||||
c.UI.Error(fmt.Sprintf("No entries found"))
|
||||
return 2
|
||||
}
|
||||
|
||||
return OutputList(c.UI, secret)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user