fix: ignore APINotImplemented errors from filesystem (#3018)

This commit is contained in:
Harshavardhana
2019-12-19 15:24:34 -08:00
committed by GitHub
parent d92d2f0d4f
commit ee283811a3
2 changed files with 23 additions and 6 deletions
+17 -5
View File
@@ -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.
+6 -1
View File
@@ -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