From 07f9486ecb8f1760ae1eb690b00089c117e20f21 Mon Sep 17 00:00:00 2001 From: vishalnayak Date: Wed, 2 Mar 2016 21:36:50 -0500 Subject: [PATCH] Added capabilities and capabilities-self endpoints to http muxer --- command/capabilities.go | 6 +----- http/handler.go | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/command/capabilities.go b/command/capabilities.go index 861f11b25..1293908de 100644 --- a/command/capabilities.go +++ b/command/capabilities.go @@ -2,7 +2,6 @@ package command import ( "fmt" - "log" "strings" ) @@ -31,11 +30,9 @@ func (c *CapabilitiesCommand) Run(args []string) int { switch len(args) { case 1: // only path is provided - log.Printf("only path is provided") path = args[0] case 2: // both token and path are provided - log.Printf("both token and path are provided") token = args[0] path = args[1] default: @@ -48,7 +45,6 @@ func (c *CapabilitiesCommand) Run(args []string) int { return 2 } - log.Printf("vishal: token:'%s' path:'%s'\n", token, path) var capabilities []string if token == "" { capabilities, err = client.Sys().CapabilitiesSelf(path) @@ -61,7 +57,7 @@ func (c *CapabilitiesCommand) Run(args []string) int { return 1 } - c.Ui.Output(fmt.Sprintf("Capabilities: '%s'", capabilities)) + c.Ui.Output(fmt.Sprintf("Capabilities: %s", capabilities)) return 0 } diff --git a/http/handler.go b/http/handler.go index a9be257e3..0a6a1081b 100644 --- a/http/handler.go +++ b/http/handler.go @@ -32,6 +32,8 @@ func Handler(core *vault.Core) http.Handler { mux.Handle("/v1/sys/generate-root/update", handleSysGenerateRootUpdate(core)) mux.Handle("/v1/sys/rekey/init", handleSysRekeyInit(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/", handleLogical(core, false))