Address some review feedback

This commit is contained in:
Jeff Mitchell 2016-01-15 11:37:14 -05:00
parent 5341cb69cc
commit 455931873a
4 changed files with 3 additions and 12 deletions

View File

@ -166,6 +166,7 @@ func outputFormatTableList(ui cli.Ui, s *api.Secret, bare bool) int {
for _, k := range s.Data["keys"].([]string) {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
input = append(input, fmt.Sprintf("%s", k))

View File

@ -30,11 +30,8 @@ func handleLogical(core *vault.Core, dataOnly bool) http.Handler {
op = logical.DeleteOperation
case "GET":
// Need to call ParseForm to get query params loaded
err := r.ParseForm()
if err != nil {
respondError(w, http.StatusBadRequest, err)
}
if r.Form.Get("list") == "true" {
queryVals := r.URL.Query()
if queryVals.Get("list") == "true" {
op = logical.ListOperation
} else {
op = logical.ReadOperation

View File

@ -3,7 +3,6 @@ package vault
import (
"encoding/json"
"fmt"
"sort"
"strings"
"github.com/hashicorp/vault/logical"
@ -168,8 +167,6 @@ func (b *CubbyholeBackend) handleList(
strippedKeys[i] = req.MountPoint + req.Path + strings.TrimPrefix(key, req.ClientToken+"/")
}
sort.Strings(strippedKeys)
// Generate the response
return logical.ListResponse(strippedKeys), nil
}

View File

@ -3,7 +3,6 @@ package vault
import (
"encoding/json"
"fmt"
"sort"
"strings"
"time"
@ -227,9 +226,6 @@ func (b *PassthroughBackend) handleList(
retKeys[i] = req.MountPoint + req.Path + k
}
// Sort
sort.Strings(retKeys)
// Generate the response
return logical.ListResponse(retKeys), nil
}