From e03a78ec45e3db9c55aea896f79fa8f345d10821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robbert=20M=C3=BCller?= Date: Thu, 17 Aug 2017 08:12:40 +0200 Subject: [PATCH] Code cleanup - added [DEBUG] tags - removed many log statements - log the right device list --- vsphere/resource_vsphere_virtual_machine.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/vsphere/resource_vsphere_virtual_machine.go b/vsphere/resource_vsphere_virtual_machine.go index e8032c299..291e7fc96 100644 --- a/vsphere/resource_vsphere_virtual_machine.go +++ b/vsphere/resource_vsphere_virtual_machine.go @@ -1062,28 +1062,24 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Invalid disks to set: %#v", disks) } - // start networkInterfaces := make([]map[string]interface{}, 0) deviceList, err := vm.Device(context.TODO()) deviceList = deviceList.SelectByType((*types.VirtualEthernetCard)(nil)) - log.Printf("Device list %+v", mvm.Config.Hardware.Device) + log.Printf("[DEBUG] Device list %+v", deviceList) for _, device := range deviceList { networkInterface := make(map[string]interface{}) - log.Printf("device %+v", device) virtualDevice := device.GetVirtualDevice() nic := device.(types.BaseVirtualEthernetCard) - log.Printf("virtualDevice info %+v\n", virtualDevice) DeviceName, _ := getNetworkName(client, vm, nic) - log.Printf("device name %s", DeviceName) - + log.Printf("[DEBUG] device name %s", DeviceName) networkInterface["label"] = DeviceName networkInterface["mac_address"] = nic.GetVirtualEthernetCard().MacAddress networkInterface["key"] = virtualDevice.Key + log.Printf("[DEBUG] networkInterface %#v", networkInterface) networkInterfaces = append(networkInterfaces, networkInterface) } log.Printf("[DEBUG] networks: %#v", networkInterfaces) - // end for _, v := range mvm.Guest.Net { if v.DeviceConfigId >= 0 {