From de1e28a77c050f77415907c08d425210443f037a Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 16 Mar 2015 10:52:35 -0700 Subject: [PATCH] vault: change to /sys/mounts --- http/sys_mount.go | 4 ++-- vault/logical_system.go | 8 ++++---- vault/logical_system_test.go | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/http/sys_mount.go b/http/sys_mount.go index c155b6278..3c5c37def 100644 --- a/http/sys_mount.go +++ b/http/sys_mount.go @@ -87,7 +87,7 @@ func handleSysMount( _, err := core.HandleRequest(&logical.Request{ Operation: logical.WriteOperation, - Path: "sys/mount/" + path, + Path: "sys/mounts/" + path, Data: map[string]interface{}{ "type": req.Type, "description": req.Description, @@ -108,7 +108,7 @@ func handleSysUnmount( path string) { _, err := core.HandleRequest(&logical.Request{ Operation: logical.DeleteOperation, - Path: "sys/mount/" + path, + Path: "sys/mounts/" + path, }) if err != nil { respondError(w, http.StatusInternalServerError, err) diff --git a/vault/logical_system.go b/vault/logical_system.go index 37b88a7f7..ec02ab6e1 100644 --- a/vault/logical_system.go +++ b/vault/logical_system.go @@ -12,13 +12,13 @@ func NewSystemBackend(core *Core) logical.Backend { return &framework.Backend{ PathsRoot: []string{ - "mount/*", + "mounts/*", "remount", }, Paths: []*framework.Path{ &framework.Path{ - Pattern: "mounts", + Pattern: "mounts$", Callbacks: map[logical.Operation]framework.OperationFunc{ logical.ReadOperation: b.handleMountTable, @@ -29,7 +29,7 @@ func NewSystemBackend(core *Core) logical.Backend { }, &framework.Path{ - Pattern: "mount/(?P.+)", + Pattern: "mounts/(?P.+)", Fields: map[string]*framework.FieldSchema{ "path": &framework.FieldSchema{ @@ -129,7 +129,7 @@ func (b *SystemBackend) handleMount( // handleUnmount is used to unmount a path func (b *SystemBackend) handleUnmount( req *logical.Request, data *framework.FieldData) (*logical.Response, error) { - suffix := strings.TrimPrefix(req.Path, "mount/") + suffix := strings.TrimPrefix(req.Path, "mounts/") if len(suffix) == 0 { return logical.ErrorResponse("path cannot be blank"), logical.ErrInvalidRequest } diff --git a/vault/logical_system_test.go b/vault/logical_system_test.go index a76b84c48..32fbbd032 100644 --- a/vault/logical_system_test.go +++ b/vault/logical_system_test.go @@ -9,7 +9,7 @@ import ( func TestSystemBackend_RootPaths(t *testing.T) { expected := []string{ - "mount/*", + "mounts/*", "remount", } @@ -46,7 +46,7 @@ func TestSystemBackend_mounts(t *testing.T) { func TestSystemBackend_mount(t *testing.T) { b := testSystemBackend(t) - req := logical.TestRequest(t, logical.WriteOperation, "mount/prod/secret/") + req := logical.TestRequest(t, logical.WriteOperation, "mounts/prod/secret/") req.Data["type"] = "generic" resp, err := b.HandleRequest(req) @@ -61,7 +61,7 @@ func TestSystemBackend_mount(t *testing.T) { func TestSystemBackend_mount_invalid(t *testing.T) { b := testSystemBackend(t) - req := logical.TestRequest(t, logical.WriteOperation, "mount/prod/secret/") + req := logical.TestRequest(t, logical.WriteOperation, "mounts/prod/secret/") req.Data["type"] = "nope" resp, err := b.HandleRequest(req) if err != logical.ErrInvalidRequest { @@ -75,7 +75,7 @@ func TestSystemBackend_mount_invalid(t *testing.T) { func TestSystemBackend_unmount(t *testing.T) { b := testSystemBackend(t) - req := logical.TestRequest(t, logical.DeleteOperation, "mount/secret/") + req := logical.TestRequest(t, logical.DeleteOperation, "mounts/secret/") resp, err := b.HandleRequest(req) if err != nil { t.Fatalf("err: %v", err) @@ -88,7 +88,7 @@ func TestSystemBackend_unmount(t *testing.T) { func TestSystemBackend_unmount_invalid(t *testing.T) { b := testSystemBackend(t) - req := logical.TestRequest(t, logical.DeleteOperation, "mount/foo/") + req := logical.TestRequest(t, logical.DeleteOperation, "mounts/foo/") resp, err := b.HandleRequest(req) if err != logical.ErrInvalidRequest { t.Fatalf("err: %v", err)