Skip to content

Commit 7e4ca47

Browse files
committed
fix: sets image or lookup to nil if the other is set
1 parent cd491ad commit 7e4ca47

File tree

1 file changed

+4
-2
lines changed
  • pkg/handlers/nutanix/mutation/machinedetails

1 file changed

+4
-2
lines changed

pkg/handlers/nutanix/mutation/machinedetails/inject.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,12 @@ func (h *nutanixMachineDetailsPatchHandler) Mutate(
100100
spec.Cluster = nutanixMachineDetailsVar.Cluster
101101

102102
switch {
103-
case nutanixMachineDetailsVar.Image != nil:
103+
case nutanixMachineDetailsVar.Image != nil && nutanixMachineDetailsVar.ImageLookup == nil:
104104
spec.Image = nutanixMachineDetailsVar.Image.DeepCopy()
105-
case nutanixMachineDetailsVar.ImageLookup != nil:
105+
spec.ImageLookup = nil
106+
case nutanixMachineDetailsVar.ImageLookup != nil && nutanixMachineDetailsVar.Image == nil:
106107
spec.ImageLookup = nutanixMachineDetailsVar.ImageLookup.DeepCopy()
108+
spec.Image = nil
107109
default:
108110
return ErrNoImageOrImageLookupSet
109111
}

0 commit comments

Comments
 (0)