Skip to content

Commit

Permalink
Switch sub-config with no IP assignment bug
Browse files Browse the repository at this point in the history
When a switch sub-config is created with no specification of IP
assignment, the code mishandles it and tries set it anyway.

Signed-off-by: Kobi Samoray <kobi.samoray@broadcom.com>
  • Loading branch information
ksamoray committed Apr 9, 2024
1 parent 2396119 commit b59fc31
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nsxt/resource_nsxt_edge_transport_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1435,9 +1435,11 @@ func setHostSwitchSpecInSchema(d *schema.ResourceData, spec *data.StructValue, n
if len(profiles) > 0 {
hsCfgOpt["host_switch_profile"] = profiles
}
hsCfgOpt["ip_assignment"], err = setIPAssignmentInSchema(tnpsc.HostSwitchConfigOption.IpAssignmentSpec)
if err != nil {
return err
if tnpsc.HostSwitchConfigOption.IpAssignmentSpec != nil {
hsCfgOpt["ip_assignment"], err = setIPAssignmentInSchema(tnpsc.HostSwitchConfigOption.IpAssignmentSpec)
if err != nil {
return err
}
}
hsCfgOpt["uplink"] = setUplinksFromSchema(tnpsc.HostSwitchConfigOption.Uplinks)
e["host_switch_config_option"] = []interface{}{hsCfgOpt}
Expand Down

0 comments on commit b59fc31

Please sign in to comment.