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 authored and koikonom committed Oct 31, 2019
1 parent 8315d70 commit a4b6343
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 a4b6343

Please # to comment.