better fix

Signed-off-by: acpana <8968914+acpana@users.noreply.github.com>
This commit is contained in:
acpana 2022-07-27 14:28:08 -07:00
parent b03467e3bd
commit 8042b3aeed
No known key found for this signature in database
GPG Key ID: 21CC0F2B42CEA01D
1 changed files with 3 additions and 10 deletions

View File

@ -346,7 +346,7 @@ func (s *Server) Establish(
return nil, err 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 return nil, err
} }
@ -408,15 +408,8 @@ func (s *Server) validatePeeringInPartition(remotePeerID, partition string) erro
return fmt.Errorf("cannot read peering by ID: %w", err) return fmt.Errorf("cannot read peering by ID: %w", err)
} }
if peering != nil { if peering != nil && peering.GetPartition() == partition {
stateStorePart := peering.Partition return fmt.Errorf("cannot create a peering within the same partition (ENT) or cluster (OSS)")
if stateStorePart == "" {
stateStorePart = "default"
}
if stateStorePart == partition {
return fmt.Errorf("cannot create a peering within the same partition (ENT) or cluster (OSS)")
}
} }
return nil return nil