Skip to content

Commit

Permalink
Skip querying preference if OS is empty
Browse files Browse the repository at this point in the history
We may have VM without OS set. In such case we get an empty string from
the map. This patch will prevent querying and erroring when we hit this
case.

Signed-off-by: Liran Rotenberg <[email protected]>
  • Loading branch information
liranr23 committed Apr 17, 2024
1 parent 78dddf5 commit 10e4845
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/controller/plan/kubevirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,10 @@ func (r *KubeVirt) vmPreference(vm *plan.VMStatus) (virtualMachine *cnv.VirtualM
if err != nil {
return
}
if preferenceName == "" {
err = liberr.New("couldn't find a corresponding preference", "vm", vm)
return
}

preferenceName, kind, err := r.getPreference(vm, preferenceName)
if err != nil {
Expand Down

0 comments on commit 10e4845

Please sign in to comment.