mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
Fallback to version 1 if the vault server is too old to have the kv preflight endpoint (#4445)
This commit is contained in:
@@ -116,6 +116,9 @@ func (c *KVGetCommand) Run(args []string) int {
|
||||
secret, err := kvReadRequest(client, path, versionParam)
|
||||
if err != nil {
|
||||
c.UI.Error(fmt.Sprintf("Error reading %s: %s", path, err))
|
||||
if secret != nil {
|
||||
OutputSecret(c.UI, secret)
|
||||
}
|
||||
return 2
|
||||
}
|
||||
if secret == nil {
|
||||
@@ -142,6 +145,11 @@ func (c *KVGetCommand) Run(args []string) int {
|
||||
return OutputSecret(c.UI, secret)
|
||||
}
|
||||
|
||||
if len(secret.Warnings) > 0 {
|
||||
tf := TableFormatter{}
|
||||
tf.printWarnings(c.UI, secret)
|
||||
}
|
||||
|
||||
if metadata, ok := secret.Data["metadata"]; ok && metadata != nil {
|
||||
c.UI.Info(getHeaderForMap("Metadata", metadata.(map[string]interface{})))
|
||||
OutputData(c.UI, metadata)
|
||||
|
||||
Reference in New Issue
Block a user