From b1b6264bea3aa151c1be26b06f08a652a27c7f90 Mon Sep 17 00:00:00 2001 From: Poorna Date: Thu, 25 Aug 2022 11:30:52 -0700 Subject: [PATCH] fix: validate deployment id when adding peer clusters (#15591) Fixes: #15573 --- cmd/site-replication.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/site-replication.go b/cmd/site-replication.go index 1066e3960..898508530 100644 --- a/cmd/site-replication.go +++ b/cmd/site-replication.go @@ -360,6 +360,9 @@ func (c *SiteReplicationSys) AddPeerClusters(ctx context.Context, psites []madmi nonLocalPeerWithBuckets = v.Name } } + if selfIdx == -1 { + return madmin.ReplicateAddStatus{}, errSRBackendIssue(fmt.Errorf("global deployment ID %s mismatch, expected one of %s", globalDeploymentID, deploymentIDsSet)) + } if !currDeploymentIDsSet.IsEmpty() { // If current cluster is already SR enabled and no new site being added ,fail. if currDeploymentIDsSet.Equals(deploymentIDsSet) {