From 875778a2d9387a78e271fc44c64046f32e364e49 Mon Sep 17 00:00:00 2001 From: vishalnayak Date: Tue, 31 May 2016 19:52:08 -0400 Subject: [PATCH] Modify just the type and not the path --- vault/auth.go | 1 - vault/auth_test.go | 8 ++++++-- vault/router.go | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/vault/auth.go b/vault/auth.go index b86401cbf..e62b61dbc 100644 --- a/vault/auth.go +++ b/vault/auth.go @@ -227,7 +227,6 @@ func (c *Core) loadCredentials() error { // The auth backend "aws-ec2" was named "aws" in the master. // This is to support upgrade procedure from "aws" to "aws-ec2". if entry.Path == "aws/" { - entry.Path = "aws-ec2/" entry.Type = "aws-ec2" needPersist = true } diff --git a/vault/auth_test.go b/vault/auth_test.go index 2049faf49..3df8f2149 100644 --- a/vault/auth_test.go +++ b/vault/auth_test.go @@ -44,8 +44,12 @@ func TestAuth_UpgradeAWSEC2Auth(t *testing.T) { // create an expected value var expectedMt MountTable expectedMt = *c.auth - expectedMt.Entries[1].Path = "aws-ec2/" - expectedMt.Entries[1].Type = "aws-ec2" + + for _, entry := range expectedMt.Entries { + if entry.Type == "aws" { + entry.Type = "aws-ec2" + } + } expected, err := json.Marshal(&expectedMt) if err != nil { t.Fatal(err) diff --git a/vault/router.go b/vault/router.go index 64f63bc3f..905d7e769 100644 --- a/vault/router.go +++ b/vault/router.go @@ -68,6 +68,9 @@ func (r *Router) Mount(backend logical.Backend, prefix string, mountEntry *Mount rootPaths: pathsToRadix(paths.Root), loginPaths: pathsToRadix(paths.Unauthenticated), } + if prefix == "auth/aws/" { + r.root.Insert("auth/aws-ec2/", re) + } r.root.Insert(prefix, re) return nil