Skip to content

Commit 6b1d625

Browse files
committed
Check for no devices in spec validation
Signed-off-by: Evan Lezar <[email protected]>
1 parent d68aa49 commit 6b1d625

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: pkg/cdi/spec.go

+3
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ func (s *Spec) validate() (map[string]*Device, error) {
236236
}
237237
devices[d.Name] = dev
238238
}
239+
if len(devices) == 0 {
240+
return nil, fmt.Errorf("invalid spec, no devices")
241+
}
239242

240243
return devices, nil
241244
}

0 commit comments

Comments
 (0)