Skip to content

Commit eca48a3

Browse files
DanielXiaosbueringer
authored andcommitted
Update internal/webhooks/vmware/vspheremachinetemplate.go
Co-authored-by: Stefan Büringer <[email protected]>
1 parent 0c17488 commit eca48a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/webhooks/vmware/vspheremachinetemplate.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ func (webhook *VSphereMachineTemplate) ValidateUpdate(ctx context.Context, oldRa
8282
return nil, apierrors.NewBadRequest(fmt.Sprintf("failed to compare old and new VSphereMachineTemplate: %v", err))
8383
}
8484
if !equal {
85-
return nil, field.Invalid(field.NewPath("spec", "template", "spec"), newObj, fmt.Sprintf("VSphereMachineTemplate spec.template.spec field is immutable. Please create a new resource instead. Diff: %s", diff))
85+
return nil, apierrors.NewInvalid(vmwarev1.GroupVersion.WithKind("VSphereMachineTemplate").GroupKind(), newObj.Name, field.ErrorList{
86+
field.Invalid(field.NewPath("spec", "template", "spec"), newObj, fmt.Sprintf("VSphereMachineTemplate spec.template.spec field is immutable. Please create a new resource instead. Diff: %s", diff)),
87+
})
8688
}
8789
}
8890

0 commit comments

Comments
 (0)