mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-15 02:57:04 +02:00
* Don't run rollback and upgrade functionality if we are a replication secondary, but do if the mount is local.
28 lines
630 B
Go
28 lines
630 B
Go
package aws
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/hashicorp/vault/helper/consts"
|
|
"github.com/hashicorp/vault/logical"
|
|
"github.com/hashicorp/vault/logical/framework"
|
|
)
|
|
|
|
var walRollbackMap = map[string]framework.WALRollbackFunc{
|
|
"user": pathUserRollback,
|
|
}
|
|
|
|
func (b *backend) walRollback(ctx context.Context, req *logical.Request, kind string, data interface{}) error {
|
|
if !b.System().LocalMount() && b.System().ReplicationState().HasState(consts.ReplicationPerformancePrimary) {
|
|
return nil
|
|
}
|
|
|
|
f, ok := walRollbackMap[kind]
|
|
if !ok {
|
|
return fmt.Errorf("unknown type to rollback")
|
|
}
|
|
|
|
return f(ctx, req, kind, data)
|
|
}
|