From ee283811a316a52d06625ce2d33bda780bd13066 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 19 Dec 2019 15:24:34 -0800 Subject: [PATCH] fix: ignore APINotImplemented errors from filesystem (#3018) --- cmd/client-fs.go | 22 +++++++++++++++++----- cmd/mirror-main.go | 7 ++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/cmd/client-fs.go b/cmd/client-fs.go index 8510740f..42681017 100644 --- a/cmd/client-fs.go +++ b/cmd/client-fs.go @@ -117,7 +117,10 @@ func (f *fsClient) GetURL() clientURL { // Select replies a stream of query results. func (f *fsClient) Select(expression string, sse encrypt.ServerSide, opts SelectObjectOpts) (io.ReadCloser, *probe.Error) { - return nil, probe.NewError(APINotImplemented{}) + return nil, probe.NewError(APINotImplemented{ + API: "Select", + APIType: "filesystem", + }) } // Watches for all fs events on an input path. @@ -1015,25 +1018,34 @@ func (f *fsClient) MakeBucket(region string, ignoreExisting, withLock bool) *pro // Set object lock configuration of bucket. func (f *fsClient) SetObjectLockConfig(mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit) *probe.Error { - return probe.NewError(APINotImplemented{API: "SetObjectLockConfig", APIType: "filesystem"}) + return probe.NewError(APINotImplemented{ + API: "SetObjectLockConfig", + APIType: "filesystem", + }) } // Get object lock configuration of bucket. func (f *fsClient) GetObjectLockConfig() (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, perr *probe.Error) { - return nil, nil, nil, probe.NewError(APINotImplemented{API: "GetObjectLockConfig", APIType: "filesystem"}) + return nil, nil, nil, probe.NewError(APINotImplemented{ + API: "GetObjectLockConfig", + APIType: "filesystem", + }) } // GetAccessRules - unsupported API func (f *fsClient) GetAccessRules() (map[string]string, *probe.Error) { return map[string]string{}, probe.NewError(APINotImplemented{ - API: "ListBucketPolicies", + API: "GetBucketPolicy", APIType: "filesystem", }) } // Set object retention for a given object. func (f *fsClient) PutObjectRetention(mode *minio.RetentionMode, retainUntilDate *time.Time) *probe.Error { - return probe.NewError(APINotImplemented{API: "PutObjectRetention", APIType: "filesystem"}) + return probe.NewError(APINotImplemented{ + API: "PutObjectRetention", + APIType: "filesystem", + }) } // GetAccess - get access policy permissions. diff --git a/cmd/mirror-main.go b/cmd/mirror-main.go index 532547f0..3b2343a2 100644 --- a/cmd/mirror-main.go +++ b/cmd/mirror-main.go @@ -544,7 +544,8 @@ func (mj *mirrorJob) watchMirror(ctx context.Context, cancelMirror context.Cance case err := <-mj.watcher.Errors(): switch err.ToGoError().(type) { case APINotImplemented: - errorIf(err.Trace(), "Unable to Watch on source, ignoring.") + errorIf(err.Trace(), + "Unable to Watch on source, perhaps source doesn't support Watching for events") return } mj.statusCh <- URLs{Error: err} @@ -711,6 +712,10 @@ func newMirrorJob(srcURL, dstURL string, isFake, isRemove, isOverwrite, isWatch, func copyBucketPolicies(srcClt, dstClt Client, isOverwrite bool) *probe.Error { rules, err := srcClt.GetAccessRules() if err != nil { + switch err.ToGoError().(type) { + case APINotImplemented: + return nil + } return err } // Set found rules to target bucket if permitted