diff --git a/cmd/bucket-replication.go b/cmd/bucket-replication.go index e1b63e032..8926a7947 100644 --- a/cmd/bucket-replication.go +++ b/cmd/bucket-replication.go @@ -117,12 +117,16 @@ func putReplicationOpts(dest replication.Destination, objInfo ObjectInfo) (putOp if err != nil { return } + sc := dest.StorageClass + if sc == "" { + sc = objInfo.StorageClass + } putOpts = miniogo.PutObjectOptions{ UserMetadata: meta, UserTags: tag.ToMap(), ContentType: objInfo.ContentType, ContentEncoding: objInfo.ContentEncoding, - StorageClass: dest.StorageClass, + StorageClass: sc, ReplicationVersionID: objInfo.VersionID, ReplicationStatus: miniogo.ReplicationStatusReplica, ReplicationMTime: objInfo.ModTime, diff --git a/docs/bucket/replication/README.md b/docs/bucket/replication/README.md index 839e0595e..7b7affcb6 100644 --- a/docs/bucket/replication/README.md +++ b/docs/bucket/replication/README.md @@ -59,7 +59,7 @@ The replication configuration can now be added to the source bucket by applying ``` ``` -mc replicate add myminio/srcbucket/Tax --priority 1 --arn "arn:minio:replication::c5be6b16-769d-432a-9ef1-4567081f3566:destbucket" --tags "Year=2019&Company=AcmeCorp" --storage-class "STANDARD" +mc replicate add myminio/srcbucket/Tax --priority 1 --arn "arn:minio:replication:us-east-1:c5be6b16-769d-432a-9ef1-4567081f3566:destbucket" --tags "Year=2019&Company=AcmeCorp" --storage-class "STANDARD" Replication configuration applied successfully to myminio/srcbucket. ``` diff --git a/pkg/bucket/replication/replication.go b/pkg/bucket/replication/replication.go index f1c1ee440..5a32b9b99 100644 --- a/pkg/bucket/replication/replication.go +++ b/pkg/bucket/replication/replication.go @@ -145,11 +145,8 @@ func (c Config) FilterActionableRules(obj ObjectOpts) []Rule { // GetDestination returns destination bucket and storage class. func (c Config) GetDestination() Destination { - for _, rule := range c.Rules { - if rule.Status == Disabled { - continue - } - return rule.Destination + if len(c.Rules) > 0 { + return c.Rules[0].Destination } return Destination{} } diff --git a/pkg/bucket/replication/rule.go b/pkg/bucket/replication/rule.go index c5615e405..f3d76ef1b 100644 --- a/pkg/bucket/replication/rule.go +++ b/pkg/bucket/replication/rule.go @@ -146,7 +146,7 @@ func (r Rule) Validate(bucket string, sameTarget bool) error { if err := r.DeleteMarkerReplication.Validate(); err != nil { return err } - if r.Priority <= 0 { + if r.Priority < 0 { return errPriorityMissing } if r.Destination.Bucket == bucket && sameTarget {