sync w ent

Signed-off-by: acpana <8968914+acpana@users.noreply.github.com>
This commit is contained in:
acpana 2022-07-27 11:41:39 -07:00
parent 0999e05a7d
commit 8b2ef80336
No known key found for this signature in database
GPG Key ID: 21CC0F2B42CEA01D
1 changed files with 10 additions and 4 deletions

View File

@ -346,8 +346,7 @@ func (s *Server) Establish(
return nil, err return nil, err
} }
// we don't want to default req.Partition unlike because partitions are empty in OSS if err := s.validatePeeringInPartition(tok.PeerID, entMeta.PartitionOrDefault()); err != nil {
if err := s.validatePeeringInPartition(tok.PeerID, req.Partition); err != nil {
return nil, err return nil, err
} }
@ -409,8 +408,15 @@ 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 && peering.Partition == partition { if peering != nil {
return fmt.Errorf("cannot create a peering within the same partition (ENT) or cluster (OSS)") stateStorePart := peering.Partition
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