Skip to content

Commit

Permalink
chore: removed error from the func because it always be nil
Browse files Browse the repository at this point in the history
expandDiskListUpdate and expandDiskLis
  • Loading branch information
PacoDw committed Jun 24, 2020
1 parent 90218ec commit a2f64b5
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions nutanix/resource_nutanix_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1261,9 +1261,9 @@ func resourceNutanixVirtualMachineUpdate(d *schema.ResourceData, meta interface{
if err != nil {
return err
}
if res.DiskList, err = expandDiskListUpdate(d, response); err != nil {
return err
}

res.DiskList = expandDiskListUpdate(d, response)

postCdromCount, err := CountDiskListCdrom(res.DiskList)
if err != nil {
return err
Expand Down Expand Up @@ -1643,11 +1643,11 @@ func getVMResources(d *schema.ResourceData, vm *v3.VMResources) error {
}
vm.SerialPortList = expandSerialPortList(d)

vmDiskList, err := expandDiskList(d)
vmDiskList := expandDiskList(d)

vm.DiskList = vmDiskList

return err
return nil
}

func expandNicList(d *schema.ResourceData) []*v3.VMNic {
Expand Down Expand Up @@ -1719,12 +1719,9 @@ func expandIPAddressList(ipl []interface{}) []*v3.IPAddress {
return nil
}

func expandDiskListUpdate(d *schema.ResourceData, vm *v3.VMIntentResponse) ([]*v3.VMDisk, error) {
var eDiskList []*v3.VMDisk
var err error
if eDiskList, err = expandDiskList(d); err != nil {
return eDiskList, err
}
func expandDiskListUpdate(d *schema.ResourceData, vm *v3.VMIntentResponse) []*v3.VMDisk {
eDiskList := expandDiskList(d)

if vm.Spec != nil && vm.Spec.Resources != nil {
for _, disk := range vm.Spec.Resources.DiskList {
if disk.DeviceProperties != nil && disk.DeviceProperties.DiskAddress != nil {
Expand All @@ -1736,10 +1733,10 @@ func expandDiskListUpdate(d *schema.ResourceData, vm *v3.VMIntentResponse) ([]*v
}
}
}
return eDiskList, nil
return eDiskList
}

func expandDiskList(d *schema.ResourceData) ([]*v3.VMDisk, error) {
func expandDiskList(d *schema.ResourceData) []*v3.VMDisk {
if v, ok := d.GetOk("disk_list"); ok {
dsk := v.([]interface{})
if len(dsk) > 0 {
Expand Down Expand Up @@ -1781,10 +1778,10 @@ func expandDiskList(d *schema.ResourceData) ([]*v3.VMDisk, error) {
}
dls[k] = dl
}
return dls, nil
return dls
}
}
return nil, nil
return nil
}

func expandStorageConfig(storageConfig []interface{}) *v3.VMStorageConfig {
Expand Down

0 comments on commit a2f64b5

Please sign in to comment.