mirror of https://github.com/hashicorp/consul
better fix
Signed-off-by: acpana <8968914+acpana@users.noreply.github.com>pull/13929/head
parent
8b2ef80336
commit
0351ca5136
|
@ -346,7 +346,7 @@ func (s *Server) Establish(
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if err := s.validatePeeringInPartition(tok.PeerID, entMeta.PartitionOrDefault()); err != nil {
|
||||
if err := s.validatePeeringInPartition(tok.PeerID, entMeta.PartitionOrEmpty()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -408,16 +408,9 @@ func (s *Server) validatePeeringInPartition(remotePeerID, partition string) erro
|
|||
return fmt.Errorf("cannot read peering by ID: %w", err)
|
||||
}
|
||||
|
||||
if peering != nil {
|
||||
stateStorePart := peering.Partition
|
||||
if stateStorePart == "" {
|
||||
stateStorePart = "default"
|
||||
}
|
||||
|
||||
if stateStorePart == partition {
|
||||
if peering != nil && peering.GetPartition() == partition {
|
||||
return fmt.Errorf("cannot create a peering within the same partition (ENT) or cluster (OSS)")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue