Skip to content

Commit

Permalink
Add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Sep 8, 2020
1 parent 16f8162 commit e346362
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/grpc/services/gateway/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
ocmprovider "github.com/cs3org/go-cs3apis/cs3/ocm/provider/v1beta1"
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/pkg/appctx"
"github.com/cs3org/reva/pkg/errtypes"
"github.com/cs3org/reva/pkg/rgrpc/status"
"github.com/cs3org/reva/pkg/rgrpc/todo/pool"
Expand Down Expand Up @@ -115,6 +116,7 @@ func (s *svc) OpenFileInAppProvider(ctx context.Context, req *gateway.OpenFileIn

func (s *svc) openFederatedShares(ctx context.Context, targetURL string, vm gateway.OpenFileInAppProviderRequest_ViewMode,
nameQueries ...string) (*providerpb.OpenFileInAppProviderResponse, error) {
log := appctx.GetLogger(ctx)
targetURL, err := appendNameQuery(targetURL, nameQueries...)
if err != nil {
return nil, err
Expand All @@ -123,6 +125,7 @@ func (s *svc) openFederatedShares(ctx context.Context, targetURL string, vm gate
if err != nil {
return nil, err
}
log.Info().Msgf("remote ep: %+v", ep)

ref := &storageprovider.Reference{
Spec: &storageprovider.Reference_Path{
Expand All @@ -146,6 +149,7 @@ func (s *svc) openFederatedShares(ctx context.Context, targetURL string, vm gate
gatewayEP = s.Endpoint.Path
}
}
log.Info().Msgf("gatewayEP: %+v", gatewayEP)

gatewayClient, err := pool.GetGatewayServiceClient(gatewayEP)
if err != nil {
Expand All @@ -154,13 +158,17 @@ func (s *svc) openFederatedShares(ctx context.Context, targetURL string, vm gate
Status: status.NewInternal(ctx, err, "error getting gateway client"),
}, nil
}
log.Info().Msg("reached here")

remoteCtx := token.ContextSetToken(context.Background(), ep.token)
remoteCtx = metadata.AppendToOutgoingContext(remoteCtx, token.TokenHeader, ep.token)
log.Info().Msgf("remoteCtx: %+v", remoteCtx)
res, err := gatewayClient.OpenFileInAppProvider(remoteCtx, appProviderReq)
if err != nil {
log.Info().Msgf("OpenFileInAppProvider returned: %+v", err)
return nil, errors.Wrap(err, "gateway: error calling OpenFileInAppProvider")
}
log.Info().Msgf("OpenFileInAppProvider result: %+v", res)
return res, nil
}

Expand Down

0 comments on commit e346362

Please sign in to comment.