minor fixes on diffs

This commit is contained in:
crn4
2026-01-21 16:13:52 +01:00
parent 9ccae8447b
commit b533c173a4
+7 -11
View File
@@ -105,9 +105,7 @@ func (a *Account) GetPeerNetworkMapComponents(
if addSourcePeers { if addSourcePeers {
var peers []string var peers []string
if policy.Rules[0].SourceResource.Type == ResourceTypePeer && policy.Rules[0].SourceResource.ID != "" { if policy.Rules[0].SourceResource.Type == ResourceTypePeer && policy.Rules[0].SourceResource.ID != "" {
if _, validated := validatedPeersMap[policy.Rules[0].SourceResource.ID]; validated { peers = []string{policy.Rules[0].SourceResource.ID}
peers = []string{policy.Rules[0].SourceResource.ID}
}
} else { } else {
peers = a.getUniquePeerIDsFromGroupsIDs(ctx, policy.SourceGroups()) peers = a.getUniquePeerIDsFromGroupsIDs(ctx, policy.SourceGroups())
} }
@@ -164,8 +162,10 @@ func (a *Account) GetPeerNetworkMapComponents(
components.RoutersMap[resource.NetworkID] = networkRoutingPeers components.RoutersMap[resource.NetworkID] = networkRoutingPeers
for peerIDKey := range networkRoutingPeers { for peerIDKey := range networkRoutingPeers {
if _, exists := components.Peers[peerIDKey]; !exists { if _, exists := components.Peers[peerIDKey]; !exists {
if p := a.Peers[peerIDKey]; p != nil { if _, validated := validatedPeersMap[peerIDKey]; validated {
components.Peers[peerIDKey] = p if p := a.Peers[peerIDKey]; p != nil {
components.Peers[peerIDKey] = p
}
} }
} }
} }
@@ -254,9 +254,7 @@ func (a *Account) getPeersGroupsPoliciesRoutes(
var peerInSources, peerInDestinations bool var peerInSources, peerInDestinations bool
if rule.SourceResource.Type == ResourceTypePeer && rule.SourceResource.ID != "" { if rule.SourceResource.Type == ResourceTypePeer && rule.SourceResource.ID != "" {
if _, validated := validatedPeersMap[rule.SourceResource.ID]; validated { sourcePeers = []string{rule.SourceResource.ID}
sourcePeers = []string{rule.SourceResource.ID}
}
if rule.SourceResource.ID == peerID { if rule.SourceResource.ID == peerID {
peerInSources = true peerInSources = true
} }
@@ -265,9 +263,7 @@ func (a *Account) getPeersGroupsPoliciesRoutes(
} }
if rule.DestinationResource.Type == ResourceTypePeer && rule.DestinationResource.ID != "" { if rule.DestinationResource.Type == ResourceTypePeer && rule.DestinationResource.ID != "" {
if _, validated := validatedPeersMap[rule.DestinationResource.ID]; validated { destinationPeers = []string{rule.DestinationResource.ID}
destinationPeers = []string{rule.DestinationResource.ID}
}
if rule.DestinationResource.ID == peerID { if rule.DestinationResource.ID == peerID {
peerInDestinations = true peerInDestinations = true
} }