From 919b68ae3e29fbfd2f4f4fa49c0b83877ff98a7f Mon Sep 17 00:00:00 2001 From: Poorna Krishnamoorthy Date: Tue, 25 Jun 2024 19:20:52 -0700 Subject: [PATCH] fix replication validation for Role ARN --- pkg/replication/replication.go | 3 +++ pkg/replication/replication_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/replication/replication.go b/pkg/replication/replication.go index 0abbf6efca..65a2f75e94 100644 --- a/pkg/replication/replication.go +++ b/pkg/replication/replication.go @@ -406,6 +406,9 @@ func (c *Config) EditRule(opts Options) error { return fmt.Errorf("priority must be unique. Replication configuration already has a rule with this priority") } if rule.Destination.Bucket != newRule.Destination.Bucket && rule.ID == newRule.ID { + if c.Role == newRule.Destination.Bucket { + continue + } return fmt.Errorf("invalid destination bucket for this rule") } } diff --git a/pkg/replication/replication_test.go b/pkg/replication/replication_test.go index 1e29f79402..cb85259b21 100644 --- a/pkg/replication/replication_test.go +++ b/pkg/replication/replication_test.go @@ -180,7 +180,7 @@ func TestEditReplicationRule(t *testing.T) { StorageClass: "STANDARD", DestBucket: "arn:minio:replication:eu-west-1:c5acb6ac-9918-4dc6-8534-6244ed1a611a:destbucket", }, - expectedErr: "invalid destination bucket for this rule", + expectedErr: "", }, { // test case :2 mismatched rule id cfg: Config{