@@ -890,10 +890,7 @@ func (vc *VmwareSource) syncVMInterfaces(nbi *inventory.NetboxInventory, vmwareV
890
890
vmIPv4Addresses , vmIPv6Addresses = vc .addVMInterfaceIPs (nbi , nbVMInterface , nicIPv4Addresses , nicIPv6Addresses , vmIPv4Addresses , vmIPv6Addresses )
891
891
}
892
892
}
893
- err := vc .setVMPrimaryIPAddress (nbi , netboxVM , vmDefaultGatewayIpv4 , vmDefaultGatewayIpv6 , vmIPv4Addresses , vmIPv6Addresses )
894
- if err != nil {
895
- return fmt .Errorf ("setting vm primary ip address: %s" , err )
896
- }
893
+ vc .setVMPrimaryIPAddress (nbi , netboxVM , vmDefaultGatewayIpv4 , vmDefaultGatewayIpv6 , vmIPv4Addresses , vmIPv6Addresses )
897
894
return nil
898
895
}
899
896
@@ -1111,7 +1108,7 @@ func (vc *VmwareSource) addVMInterfaceIPs(nbi *inventory.NetboxInventory, nbVMIn
1111
1108
// we loop through all of the collected IPv4 and IPv6 addresses for the vm.
1112
1109
// If any of the ips is in the same subnet as the default gateway, we choose it.
1113
1110
// If there is no ip in the subnet of the default gateway, we choose the first one.
1114
- func (vc * VmwareSource ) setVMPrimaryIPAddress (nbi * inventory.NetboxInventory , netboxVM * objects.VM , vmDefaultGatewayIpv4 string , vmDefaultGatewayIpv6 string , vmIPv4Addresses []* objects.IPAddress , vmIPv6Addresses []* objects.IPAddress ) error {
1111
+ func (vc * VmwareSource ) setVMPrimaryIPAddress (nbi * inventory.NetboxInventory , netboxVM * objects.VM , vmDefaultGatewayIpv4 string , vmDefaultGatewayIpv6 string , vmIPv4Addresses []* objects.IPAddress , vmIPv6Addresses []* objects.IPAddress ) {
1115
1112
if len (vmIPv4Addresses ) > 0 || len (vmIPv6Addresses ) > 0 {
1116
1113
var vmIPv4PrimaryAddress * objects.IPAddress
1117
1114
for _ , addr := range vmIPv4Addresses {
@@ -1130,10 +1127,9 @@ func (vc *VmwareSource) setVMPrimaryIPAddress(nbi *inventory.NetboxInventory, ne
1130
1127
newNetboxVM .PrimaryIPv6 = vmIPv6PrimaryAddress
1131
1128
_ , err := nbi .AddVM (vc .Ctx , & newNetboxVM )
1132
1129
if err != nil {
1133
- return fmt . Errorf ( "updating vm's primary ip: %s" , err )
1130
+ vc . Logger . Warningf ( vc . Ctx , "updating vm's primary ip: %s" , err )
1134
1131
}
1135
1132
}
1136
- return nil
1137
1133
}
1138
1134
1139
1135
func (vc * VmwareSource ) addVMContact (nbi * inventory.NetboxInventory , nbVM * objects.VM , vmOwners []string , vmOwnerEmails []string ) error {
0 commit comments