Skip to content

Commit

Permalink
move unwrapping and wrapping of paths to the gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
David Christofas committed Jul 7, 2021
1 parent 54e2236 commit 3780c26
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 271 deletions.
18 changes: 12 additions & 6 deletions internal/grpc/services/gateway/ocmshareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,19 +342,25 @@ func (s *svc) createOCMReference(ctx context.Context, share *ocm.Share) (*rpc.St
}

log.Info().Msg("mount path will be:" + refPath)
createRefReq := &provider.CreateReferenceRequest{
Ref: &provider.Reference{Path: refPath},
TargetUri: targetURI,
}

c, err := s.findByPath(ctx, refPath)
c, p, err := s.findByPath(ctx, refPath)
if err != nil {
if _, ok := err.(errtypes.IsNotFound); ok {
return status.NewNotFound(ctx, "storage provider not found"), nil
}
return status.NewInternal(ctx, err, "error finding storage provider"), nil
}

pRef, err := unwrap(&provider.Reference{Path: refPath}, p.ProviderPath)
if err != nil {
log.Err(err).Msg("gateway: error unwrapping")
return &rpc.Status{
Code: rpc.Code_CODE_INTERNAL,
}, nil
}
createRefReq := &provider.CreateReferenceRequest{
Ref: pRef,
TargetUri: targetURI,
}
createRefRes, err := c.CreateReference(ctx, createRefReq)
if err != nil {
log.Err(err).Msg("gateway: error calling GetHome")
Expand Down
Loading

0 comments on commit 3780c26

Please sign in to comment.