Added capabilities and capabilities-self endpoints to http muxer

This commit is contained in:
vishalnayak 2016-03-02 21:36:50 -05:00
parent abfbc74bd4
commit 07f9486ecb
2 changed files with 3 additions and 5 deletions

View File

@ -2,7 +2,6 @@ package command
import ( import (
"fmt" "fmt"
"log"
"strings" "strings"
) )
@ -31,11 +30,9 @@ func (c *CapabilitiesCommand) Run(args []string) int {
switch len(args) { switch len(args) {
case 1: case 1:
// only path is provided // only path is provided
log.Printf("only path is provided")
path = args[0] path = args[0]
case 2: case 2:
// both token and path are provided // both token and path are provided
log.Printf("both token and path are provided")
token = args[0] token = args[0]
path = args[1] path = args[1]
default: default:
@ -48,7 +45,6 @@ func (c *CapabilitiesCommand) Run(args []string) int {
return 2 return 2
} }
log.Printf("vishal: token:'%s' path:'%s'\n", token, path)
var capabilities []string var capabilities []string
if token == "" { if token == "" {
capabilities, err = client.Sys().CapabilitiesSelf(path) capabilities, err = client.Sys().CapabilitiesSelf(path)
@ -61,7 +57,7 @@ func (c *CapabilitiesCommand) Run(args []string) int {
return 1 return 1
} }
c.Ui.Output(fmt.Sprintf("Capabilities: '%s'", capabilities)) c.Ui.Output(fmt.Sprintf("Capabilities: %s", capabilities))
return 0 return 0
} }

View File

@ -32,6 +32,8 @@ func Handler(core *vault.Core) http.Handler {
mux.Handle("/v1/sys/generate-root/update", handleSysGenerateRootUpdate(core)) mux.Handle("/v1/sys/generate-root/update", handleSysGenerateRootUpdate(core))
mux.Handle("/v1/sys/rekey/init", handleSysRekeyInit(core)) mux.Handle("/v1/sys/rekey/init", handleSysRekeyInit(core))
mux.Handle("/v1/sys/rekey/update", handleSysRekeyUpdate(core)) mux.Handle("/v1/sys/rekey/update", handleSysRekeyUpdate(core))
mux.Handle("/v1/sys/capabilities", handleSysCapabilities(core))
mux.Handle("/v1/sys/capabilities-self", handleSysCapabilities(core))
mux.Handle("/v1/sys/", handleLogical(core, true)) mux.Handle("/v1/sys/", handleLogical(core, true))
mux.Handle("/v1/", handleLogical(core, false)) mux.Handle("/v1/", handleLogical(core, false))