Skip to content

Commit

Permalink
Rename variable for readabilty
Browse files Browse the repository at this point in the history
  • Loading branch information
damyan committed Nov 27, 2024
1 parent 9b22b9e commit 2522252
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/webhook/v1alpha1/endpoint_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func ValidateMACAddressCreate(ctx context.Context, c client.Client, spec metalv1
return allErrs
}

func ValidateMACAddressUpdate(ctx context.Context, c client.Client, existing *metalv1alpha1.Endpoint, path *field.Path) field.ErrorList {
func ValidateMACAddressUpdate(ctx context.Context, c client.Client, updatedEndpoint *metalv1alpha1.Endpoint, path *field.Path) field.ErrorList {
allErrs := field.ErrorList{}

endpoints := &metalv1alpha1.EndpointList{}
Expand All @@ -128,7 +128,7 @@ func ValidateMACAddressUpdate(ctx context.Context, c client.Client, existing *me
}

for _, e := range endpoints.Items {
if e.Spec.MACAddress == existing.Spec.MACAddress && e.Name != existing.Name {
if e.Spec.MACAddress == updatedEndpoint.Spec.MACAddress && e.Name != updatedEndpoint.Name {
allErrs = append(allErrs, field.Duplicate(field.NewPath("spec").Child("MACAddress"), e.Spec.MACAddress))
}
}
Expand Down

0 comments on commit 2522252

Please sign in to comment.