Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup code #3530

Merged
merged 4 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/unreleased/improve-ocmd-error-logs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Enhancement: Improve error logging in ocmd flow

https://github.com/cs3org/reva/pull/3530
https://github.com/cs3org/reva/pull/3526
https://github.com/cs3org/reva/pull/3419
https://github.com/cs3org/reva/issues/3365
Expand Down
10 changes: 0 additions & 10 deletions pkg/ocm/share/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
"github.com/cs3org/reva/pkg/appctx"
ctxpkg "github.com/cs3org/reva/pkg/ctx"
"github.com/cs3org/reva/pkg/errtypes"
"github.com/cs3org/reva/pkg/ocm/share"
Expand Down Expand Up @@ -265,15 +264,6 @@ func (m *mgr) Share(ctx context.Context, md *provider.ResourceId, g *ocm.ShareGr
protocol["name"] = "datatx"
}

log := appctx.GetLogger(ctx)
log.Info().Msg("pkg/ocm/share/manager/json calls sender.Send")
log.Info().Msgf("pkg/ocm/share/manager/json shareWith: %s", g.Grantee.GetUserId().OpaqueId)
log.Info().Msgf("pkg/ocm/share/manager/json name: %s", name)
log.Info().Msgf("pkg/ocm/share/manager/json providerId: %s", fmt.Sprintf("%s:%s", md.StorageId, md.OpaqueId))
log.Info().Msgf("pkg/ocm/share/manager/json owner: %s", userID.OpaqueId)
log.Info().Msgf("pkg/ocm/share/manager/json protocol: %s", protocol)
log.Info().Msgf("pkg/ocm/share/manager/json meshProvider: %s", userID.Idp)

requestBodyMap := map[string]interface{}{
"shareWith": g.Grantee.GetUserId().OpaqueId,
"name": name,
Expand Down
30 changes: 10 additions & 20 deletions pkg/ocm/share/manager/nextcloud/nextcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,16 +362,6 @@ func (sm *Manager) Share(ctx context.Context, md *provider.ResourceId, g *ocm.Sh
}
}

log := appctx.GetLogger(ctx)
log.Info().Msg("pkg/ocm/share/manager/nextcloud calls sender.Send")
log.Info().Msgf("pkg/ocm/share/manager/nextcloud shareWith: %s", g.Grantee.GetUserId().OpaqueId)
log.Info().Msgf("pkg/ocm/share/manager/nextcloud name: %s", name)
log.Info().Msgf("pkg/ocm/share/manager/nextcloud providerId: %s", s.Id.OpaqueId)
log.Info().Msgf("pkg/ocm/share/manager/nextcloud owner: %s", userID.OpaqueId)
log.Info().Msgf("pkg/ocm/share/manager/nextcloud protocol: %s", protocol)
log.Info().Msgf("pkg/ocm/share/manager/nextcloud meshProvider: %s", userID.Idp)
log.Info().Msgf("Truncating name from %s to %s", name, name[5:])

// required:
// shareWith string Consumer specific identifier of the user or group the provider wants to share the resource with. This is known in advance. Please note that the consumer service endpoint is known in advance as well, so this is no part of the request body.
// name string Name of the resource (file or folder).
Expand Down Expand Up @@ -543,15 +533,15 @@ func (sm *Manager) ListReceivedShares(ctx context.Context) ([]*ocm.ReceivedShare
if err != nil {
return nil, err
}
var pointersBaseShare = make([]*ocm.Share, len(respArr))
var pointersReceivedShare = make([]*ocm.ReceivedShare, len(respArr))
for i := 0; i < len(respArr); i++ {
log.Info().Msgf("Unpacking share object %+v\n", respArr[i].Share)
altResultShare := respArr[i].Share

var pointersReceivedShare = make([]*ocm.ReceivedShare, 0, len(respArr))
for _, share := range respArr {
altResultShare := share.Share
log.Info().Msgf("Unpacking share object %+v\n", altResultShare)
if altResultShare == nil {
return nil, errors.New("received an unreadable share object from the EFSS backend")
}
pointersBaseShare[i] = &ocm.Share{
s := &ocm.Share{
Id: altResultShare.ID,
ResourceId: altResultShare.ResourceID,
Permissions: altResultShare.Permissions,
Expand All @@ -563,10 +553,10 @@ func (sm *Manager) ListReceivedShares(ctx context.Context) ([]*ocm.ReceivedShare
Ctime: altResultShare.Ctime,
Mtime: altResultShare.Mtime,
}
pointersReceivedShare[i] = &ocm.ReceivedShare{
Share: pointersBaseShare[i],
State: respArr[i].State,
}
pointersReceivedShare = append(pointersReceivedShare, &ocm.ReceivedShare{
Share: s,
State: share.State,
})
}
return pointersReceivedShare, err
}
Expand Down