Modify just the type and not the path

This commit is contained in:
vishalnayak 2016-05-31 19:52:08 -04:00
parent 55fbfab4fe
commit 875778a2d9
3 changed files with 9 additions and 3 deletions

View File

@ -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
}

View File

@ -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)

View File

@ -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