Skip to content

Commit

Permalink
Update internal/webhooks/vspheremachinetemplate.go
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Schlotter <[email protected]>
  • Loading branch information
birksl and chrischdi authored May 31, 2024
1 parent 7a1af63 commit eb17a44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/webhooks/vspheremachinetemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ func (webhook *VSphereMachineTemplateWebhook) ValidateCreate(_ context.Context,
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "template", "spec", "guestSoftPowerOffTimeout"), spec.GuestSoftPowerOffTimeout, "should be greater than 0"))
}
}
for _, device := range spec.PciDevices {
for i, device := range spec.PciDevices {
hasVGPU := device.VGPUProfile != ""
hasPCI := device.DeviceID != nil && device.VendorID != nil
if (hasPCI && hasVGPU) || (!hasPCI && !hasVGPU) {
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "template", "spec", "pciDevices"), spec.PciDevices, "should have either deviceID + vendorID or vgpuProfile"))
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "template", "spec", "pciDevices", fmt.Sprintf("%d, i)), device, "should have either deviceID + vendorID or vgpuProfile"))

Check failure on line 91 in internal/webhooks/vspheremachinetemplate.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected should in argument list; possibly missing comma or )

Check failure on line 91 in internal/webhooks/vspheremachinetemplate.go

View workflow job for this annotation

GitHub Actions / lint

newline in string

Check failure on line 91 in internal/webhooks/vspheremachinetemplate.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected should in argument list; possibly missing comma or )

Check failure on line 91 in internal/webhooks/vspheremachinetemplate.go

View workflow job for this annotation

GitHub Actions / lint

newline in string

Check failure on line 91 in internal/webhooks/vspheremachinetemplate.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected should in argument list; possibly missing comma or )

Check failure on line 91 in internal/webhooks/vspheremachinetemplate.go

View workflow job for this annotation

GitHub Actions / lint

newline in string
}

Check failure on line 92 in internal/webhooks/vspheremachinetemplate.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected } in argument list; possibly missing comma or )) (typecheck)

Check failure on line 92 in internal/webhooks/vspheremachinetemplate.go

View workflow job for this annotation

GitHub Actions / lint

syntax error: unexpected } in argument list; possibly missing comma or )) (typecheck)
}
return nil, AggregateObjErrors(obj.GroupVersionKind().GroupKind(), obj.Name, allErrs)
Expand Down

0 comments on commit eb17a44

Please sign in to comment.