mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	Add path attributes to indicate when operations should forward (#7175)
This commit is contained in:
		| @@ -15,7 +15,8 @@ import ( | ||||
|  | ||||
| 	"github.com/hashicorp/errwrap" | ||||
| 	log "github.com/hashicorp/go-hclog" | ||||
| 	multierror "github.com/hashicorp/go-multierror" | ||||
| 	"github.com/hashicorp/go-multierror" | ||||
| 	"github.com/hashicorp/vault/sdk/helper/consts" | ||||
| 	"github.com/hashicorp/vault/sdk/helper/entropy" | ||||
| 	"github.com/hashicorp/vault/sdk/helper/errutil" | ||||
| 	"github.com/hashicorp/vault/sdk/helper/license" | ||||
| @@ -225,6 +226,19 @@ func (b *Backend) HandleRequest(ctx context.Context, req *logical.Request) (*log | ||||
|  | ||||
| 	if path.Operations != nil { | ||||
| 		if op, ok := path.Operations[req.Operation]; ok { | ||||
|  | ||||
| 			// Check whether this operation should be forwarded | ||||
| 			replState := b.System().ReplicationState() | ||||
| 			props := op.Properties() | ||||
|  | ||||
| 			if props.ForwardPerformanceStandby && replState.HasState(consts.ReplicationPerformanceStandby) { | ||||
| 				return nil, logical.ErrReadOnly | ||||
| 			} | ||||
|  | ||||
| 			if props.ForwardPerformanceSecondary && !b.System().LocalMount() && replState.HasState(consts.ReplicationPerformanceSecondary) { | ||||
| 				return nil, logical.ErrReadOnly | ||||
| 			} | ||||
|  | ||||
| 			callback = op.Handler() | ||||
| 		} | ||||
| 	} else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jim Kalafut
					Jim Kalafut