Skip to content

Commit

Permalink
Added validation for no two node provisioning (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
SivaanandM authored Oct 10, 2024
1 parent 35bf354 commit 61a066b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions spectrocloud/resource_cluster_edge_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,11 +643,14 @@ func toEdgeHosts(m map[string]interface{}) (*models.V1EdgeNativeMachinePoolCloud
StaticIP: host.(map[string]interface{})["static_ip"].(string),
}
if v, ok := host.(map[string]interface{})["two_node_role"].(string); ok {
if _, ok := twoNodeHostRoles[v]; ok {
return nil, fmt.Errorf("two node role '%s' already assigned to edge host '%s'; roles must be unique", v, hostId)
if v != "" {
if _, ok := twoNodeHostRoles[v]; ok {
return nil, fmt.Errorf("two node role '%s' already assigned to edge host '%s'; roles must be unique", v, hostId)
}
edgeHost.TwoNodeCandidatePriority = v
twoNodeHostRoles[v] = hostId
}
edgeHost.TwoNodeCandidatePriority = v
twoNodeHostRoles[v] = hostId

}
edgeHosts = append(edgeHosts, edgeHost)
}
Expand Down

0 comments on commit 61a066b

Please sign in to comment.