Skip to content

Commit e24ecef

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

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/cdi/spec.go

Lines changed: 3 additions & 0 deletions
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)