Skip to content

Commit

Permalink
Check if portgroup failure criteria is nil
Browse files Browse the repository at this point in the history
Sometimes govmomi will return a PortGroup spec where the failure
criteria property of the nic teaming policy can be nil.

When this happens we crash because the code doesn't check for this case.

Addresses the crash in #869
  • Loading branch information
Kyriakos Oikonomakos committed Oct 31, 2019
1 parent ff889ef commit 12e7d8a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vsphere/host_network_policy_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,10 @@ func flattenHostNicTeamingPolicy(d *schema.ResourceData, obj *types.HostNicTeami
d.Set("notify_switches", obj.NotifySwitches)
}
d.Set("teaming_policy", obj.Policy)
if err := flattenHostNicFailureCriteria(d, obj.FailureCriteria); err != nil {
return err
if obj.FailureCriteria != nil {
if err := flattenHostNicFailureCriteria(d, obj.FailureCriteria); err != nil {
return err
}
}
if err := flattenHostNicOrderPolicy(d, obj.NicOrder); err != nil {
return err
Expand Down

0 comments on commit 12e7d8a

Please # to comment.