mirror of
https://github.com/hashicorp/vault.git
synced 2025-09-03 04:51:12 +02:00
Remove noop checks in unmount/remount and restore previous behavior
This commit is contained in:
parent
51e948c8fc
commit
84c67e3f91
@ -221,18 +221,11 @@ func (c *Core) unmount(path string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify exact match of the route
|
// Verify exact match of the route
|
||||||
match := c.router.MatchingMountEntry(path)
|
match := c.router.MatchingMount(path)
|
||||||
if match == nil || path != match.Path {
|
if match == "" || path != match {
|
||||||
return fmt.Errorf("no matching mount")
|
return fmt.Errorf("no matching mount")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not allow singleton mounts to be removed
|
|
||||||
for _, p := range singletonMounts {
|
|
||||||
if match.Type == p {
|
|
||||||
return logical.CodedError(403, fmt.Sprintf("Cannot unmount backend of type '%s'", match.Type))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Store the view for this backend
|
// Store the view for this backend
|
||||||
view := c.router.MatchingView(path)
|
view := c.router.MatchingView(path)
|
||||||
|
|
||||||
@ -323,18 +316,11 @@ func (c *Core) remount(src, dst string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify exact match of the route
|
// Verify exact match of the route
|
||||||
match := c.router.MatchingMountEntry(src)
|
match := c.router.MatchingMount(src)
|
||||||
if match == nil || src != match.Path {
|
if match == "" || src != match {
|
||||||
return fmt.Errorf("no matching mount at '%s'", src)
|
return fmt.Errorf("no matching mount at '%s'", src)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not allow singleton mounts to be removed
|
|
||||||
for _, p := range singletonMounts {
|
|
||||||
if match.Type == p {
|
|
||||||
return logical.CodedError(403, fmt.Sprintf("Cannot remount backend of type '%s'", match.Type))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if match := c.router.MatchingMount(dst); match != "" {
|
if match := c.router.MatchingMount(dst); match != "" {
|
||||||
return fmt.Errorf("existing mount at '%s'", match)
|
return fmt.Errorf("existing mount at '%s'", match)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user