Avoid unnecessary logging for policy not found errors (#6104)

master
Harshavardhana 7 years ago committed by kannappanr
parent f53d511798
commit 92a6676a2f
  1. 1
      cmd/gateway/azure/gateway-azure.go
  2. 1
      cmd/gateway/b2/gateway-b2.go
  3. 4
      cmd/gateway/gcs/gateway-gcs.go
  4. 1
      cmd/gateway/oss/gateway-oss.go
  5. 1
      cmd/gateway/s3/gateway-s3.go

@ -1131,7 +1131,6 @@ func (a *azureObjects) GetBucketPolicy(ctx context.Context, bucket string) (*pol
} }
if perm.AccessType == storage.ContainerAccessTypePrivate { if perm.AccessType == storage.ContainerAccessTypePrivate {
logger.LogIf(ctx, minio.BucketPolicyNotFound{Bucket: bucket})
return nil, minio.BucketPolicyNotFound{Bucket: bucket} return nil, minio.BucketPolicyNotFound{Bucket: bucket}
} else if perm.AccessType != storage.ContainerAccessTypeContainer { } else if perm.AccessType != storage.ContainerAccessTypeContainer {
logger.LogIf(ctx, minio.NotImplemented{}) logger.LogIf(ctx, minio.NotImplemented{})

@ -772,7 +772,6 @@ func (l *b2Objects) GetBucketPolicy(ctx context.Context, bucket string) (*policy
// just return back as policy not found for all cases. // just return back as policy not found for all cases.
// CreateBucket always sets the value to allPrivate by default. // CreateBucket always sets the value to allPrivate by default.
if bkt.Type != bucketTypeReadOnly { if bkt.Type != bucketTypeReadOnly {
logger.LogIf(ctx, minio.BucketPolicyNotFound{Bucket: bucket})
return nil, minio.BucketPolicyNotFound{Bucket: bucket} return nil, minio.BucketPolicyNotFound{Bucket: bucket}
} }

@ -1136,7 +1136,6 @@ func (l *gcsGateway) CompleteMultipartUpload(ctx context.Context, bucket string,
func (l *gcsGateway) SetBucketPolicy(ctx context.Context, bucket string, bucketPolicy *policy.Policy) error { func (l *gcsGateway) SetBucketPolicy(ctx context.Context, bucket string, bucketPolicy *policy.Policy) error {
policyInfo, err := minio.PolicyToBucketAccessPolicy(bucketPolicy) policyInfo, err := minio.PolicyToBucketAccessPolicy(bucketPolicy)
if err != nil { if err != nil {
// This should not happen.
logger.LogIf(ctx, err) logger.LogIf(ctx, err)
return gcsToObjectError(err, bucket) return gcsToObjectError(err, bucket)
} }
@ -1192,7 +1191,6 @@ func (l *gcsGateway) SetBucketPolicy(ctx context.Context, bucket string, bucketP
func (l *gcsGateway) GetBucketPolicy(ctx context.Context, bucket string) (*policy.Policy, error) { func (l *gcsGateway) GetBucketPolicy(ctx context.Context, bucket string) (*policy.Policy, error) {
rules, err := l.client.Bucket(bucket).ACL().List(l.ctx) rules, err := l.client.Bucket(bucket).ACL().List(l.ctx)
if err != nil { if err != nil {
logger.LogIf(ctx, err)
return nil, gcsToObjectError(err, bucket) return nil, gcsToObjectError(err, bucket)
} }
@ -1227,7 +1225,6 @@ func (l *gcsGateway) GetBucketPolicy(ctx context.Context, bucket string) (*polic
// Return NoSuchBucketPolicy error, when policy is not set // Return NoSuchBucketPolicy error, when policy is not set
if len(actionSet) == 0 { if len(actionSet) == 0 {
logger.LogIf(ctx, minio.BucketPolicyNotFound{})
return nil, gcsToObjectError(minio.BucketPolicyNotFound{}, bucket) return nil, gcsToObjectError(minio.BucketPolicyNotFound{}, bucket)
} }
@ -1252,7 +1249,6 @@ func (l *gcsGateway) GetBucketPolicy(ctx context.Context, bucket string) (*polic
func (l *gcsGateway) DeleteBucketPolicy(ctx context.Context, bucket string) error { func (l *gcsGateway) DeleteBucketPolicy(ctx context.Context, bucket string) error {
// This only removes the storage.AllUsers policies // This only removes the storage.AllUsers policies
if err := l.client.Bucket(bucket).ACL().Delete(l.ctx, storage.AllUsers); err != nil { if err := l.client.Bucket(bucket).ACL().Delete(l.ctx, storage.AllUsers); err != nil {
logger.LogIf(ctx, err)
return gcsToObjectError(err, bucket) return gcsToObjectError(err, bucket)
} }

@ -1018,7 +1018,6 @@ func (l *ossObjects) GetBucketPolicy(ctx context.Context, bucket string) (*polic
switch result.ACL { switch result.ACL {
case string(oss.ACLPrivate): case string(oss.ACLPrivate):
// By default, all buckets starts with a "private" policy. // By default, all buckets starts with a "private" policy.
logger.LogIf(ctx, minio.BucketPolicyNotFound{})
return nil, ossToObjectError(minio.BucketPolicyNotFound{}, bucket) return nil, ossToObjectError(minio.BucketPolicyNotFound{}, bucket)
case string(oss.ACLPublicRead): case string(oss.ACLPublicRead):
readOnly = true readOnly = true

@ -464,7 +464,6 @@ func (l *s3Objects) SetBucketPolicy(ctx context.Context, bucket string, bucketPo
func (l *s3Objects) GetBucketPolicy(ctx context.Context, bucket string) (*policy.Policy, error) { func (l *s3Objects) GetBucketPolicy(ctx context.Context, bucket string) (*policy.Policy, error) {
data, err := l.Client.GetBucketPolicy(bucket) data, err := l.Client.GetBucketPolicy(bucket)
if err != nil { if err != nil {
logger.LogIf(ctx, err)
return nil, minio.ErrorRespToObjectError(err, bucket) return nil, minio.ErrorRespToObjectError(err, bucket)
} }

Loading…
Cancel
Save