mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 02:57:59 +00:00
Add context to storage backends and wire it through a lot of places (#3817)
This commit is contained in:
committed by
Jeff Mitchell
parent
2864fbd697
commit
8142b42d95
@@ -45,8 +45,8 @@ func (s *gRPCSystemViewClient) MaxLeaseTTL() time.Duration {
|
||||
return time.Duration(reply.TTL)
|
||||
}
|
||||
|
||||
func (s *gRPCSystemViewClient) SudoPrivilege(path string, token string) bool {
|
||||
reply, err := s.client.SudoPrivilege(context.Background(), &pb.SudoPrivilegeArgs{
|
||||
func (s *gRPCSystemViewClient) SudoPrivilege(ctx context.Context, path string, token string) bool {
|
||||
reply, err := s.client.SudoPrivilege(ctx, &pb.SudoPrivilegeArgs{
|
||||
Path: path,
|
||||
Token: token,
|
||||
})
|
||||
@@ -84,13 +84,13 @@ func (s *gRPCSystemViewClient) ReplicationState() consts.ReplicationState {
|
||||
return consts.ReplicationState(reply.State)
|
||||
}
|
||||
|
||||
func (s *gRPCSystemViewClient) ResponseWrapData(data map[string]interface{}, ttl time.Duration, jwt bool) (*wrapping.ResponseWrapInfo, error) {
|
||||
func (s *gRPCSystemViewClient) ResponseWrapData(ctx context.Context, data map[string]interface{}, ttl time.Duration, jwt bool) (*wrapping.ResponseWrapInfo, error) {
|
||||
buf, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
reply, err := s.client.ResponseWrapData(context.Background(), &pb.ResponseWrapDataArgs{
|
||||
reply, err := s.client.ResponseWrapData(ctx, &pb.ResponseWrapDataArgs{
|
||||
Data: buf,
|
||||
TTL: int64(ttl),
|
||||
JWT: false,
|
||||
@@ -110,7 +110,7 @@ func (s *gRPCSystemViewClient) ResponseWrapData(data map[string]interface{}, ttl
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (s *gRPCSystemViewClient) LookupPlugin(name string) (*pluginutil.PluginRunner, error) {
|
||||
func (s *gRPCSystemViewClient) LookupPlugin(ctx context.Context, name string) (*pluginutil.PluginRunner, error) {
|
||||
return nil, fmt.Errorf("cannot call LookupPlugin from a plugin backend")
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ func (s *gRPCSystemViewServer) MaxLeaseTTL(ctx context.Context, _ *pb.Empty) (*p
|
||||
}
|
||||
|
||||
func (s *gRPCSystemViewServer) SudoPrivilege(ctx context.Context, args *pb.SudoPrivilegeArgs) (*pb.SudoPrivilegeReply, error) {
|
||||
sudo := s.impl.SudoPrivilege(args.Path, args.Token)
|
||||
sudo := s.impl.SudoPrivilege(ctx, args.Path, args.Token)
|
||||
return &pb.SudoPrivilegeReply{
|
||||
Sudo: sudo,
|
||||
}, nil
|
||||
@@ -177,7 +177,7 @@ func (s *gRPCSystemViewServer) ResponseWrapData(ctx context.Context, args *pb.Re
|
||||
}
|
||||
|
||||
// Do not allow JWTs to be returned
|
||||
info, err := s.impl.ResponseWrapData(data, time.Duration(args.TTL), false)
|
||||
info, err := s.impl.ResponseWrapData(ctx, data, time.Duration(args.TTL), false)
|
||||
if err != nil {
|
||||
return &pb.ResponseWrapDataReply{
|
||||
Err: pb.ErrToString(err),
|
||||
|
||||
Reference in New Issue
Block a user